Auth
5 months ago
Cookie
5 months ago
Exception
5 months ago
Proxy
5 months ago
Response
5 months ago
Transport
5 months ago
Utility
5 months ago
Auth.php
5 months ago
Autoload.php
5 months ago
Capability.php
5 months ago
Cookie.php
5 months ago
Exception.php
5 months ago
HookManager.php
5 months ago
Hooks.php
5 months ago
IdnaEncoder.php
5 months ago
Ipv6.php
5 months ago
Iri.php
5 months ago
Port.php
5 months ago
Proxy.php
5 months ago
Requests.php
5 months ago
Response.php
5 months ago
Session.php
5 months ago
Ssl.php
5 months ago
Transport.php
5 months ago
Exception.php
67 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Exception for HTTP requests |
| 4 | * |
| 5 | * @package Requests\Exceptions |
| 6 | */ |
| 7 | |
| 8 | namespace AmeliaVendor\WpOrg\Requests; |
| 9 | |
| 10 | use Exception as PHPException; |
| 11 | |
| 12 | /** |
| 13 | * Exception for HTTP requests |
| 14 | * |
| 15 | * @package Requests\Exceptions |
| 16 | */ |
| 17 | class Exception extends PHPException { |
| 18 | /** |
| 19 | * Type of exception |
| 20 | * |
| 21 | * @var string |
| 22 | */ |
| 23 | protected $type; |
| 24 | |
| 25 | /** |
| 26 | * Data associated with the exception |
| 27 | * |
| 28 | * @var mixed |
| 29 | */ |
| 30 | protected $data; |
| 31 | |
| 32 | /** |
| 33 | * Create a new exception |
| 34 | * |
| 35 | * @param string $message Exception message |
| 36 | * @param string $type Exception type |
| 37 | * @param mixed $data Associated data |
| 38 | * @param integer $code Exception numerical code, if applicable |
| 39 | */ |
| 40 | public function __construct($message, $type, $data = null, $code = 0) { |
| 41 | parent::__construct($message, $code); |
| 42 | |
| 43 | $this->type = $type; |
| 44 | $this->data = $data; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Like {@see \Exception::getCode()}, but a string code. |
| 49 | * |
| 50 | * @codeCoverageIgnore |
| 51 | * @return string |
| 52 | */ |
| 53 | public function getType() { |
| 54 | return $this->type; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Gives any relevant data |
| 59 | * |
| 60 | * @codeCoverageIgnore |
| 61 | * @return mixed |
| 62 | */ |
| 63 | public function getData() { |
| 64 | return $this->data; |
| 65 | } |
| 66 | } |
| 67 |