| 1 | <?php |
||
| 13 | class Requests_Exception_HTTP extends Requests_Exception { |
||
| 14 | /** |
||
| 15 | * HTTP status code |
||
| 16 | * |
||
| 17 | * @var integer |
||
| 18 | */ |
||
| 19 | protected $code = 0; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Reason phrase |
||
| 23 | * |
||
| 24 | * @var string |
||
| 25 | */ |
||
| 26 | protected $reason = 'Unknown'; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Create a new exception |
||
| 30 | * |
||
| 31 | * There is no mechanism to pass in the status code, as this is set by the |
||
| 32 | * subclass used. Reason phrases can vary, however. |
||
| 33 | * |
||
| 34 | * @param string|null $reason Reason phrase |
||
| 35 | * @param mixed $data Associated data |
||
| 36 | */ |
||
| 37 | public function __construct($reason = null, $data = null) { |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Get the status message |
||
| 48 | */ |
||
| 49 | public function getReason() { |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Get the correct exception class for a given error code |
||
| 55 | * |
||
| 56 | * @param int|bool $code HTTP status code, or false if unavailable |
||
| 57 | * @return string Exception class name to use |
||
| 58 | */ |
||
| 59 | public static function get_class($code) { |
||
| 71 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.