@@ -11,17 +11,17 @@ |
||
11 | 11 | * @package Requests |
12 | 12 | */ |
13 | 13 | class Requests_Exception_HTTP_410 extends Requests_Exception_HTTP { |
14 | - /** |
|
15 | - * HTTP status code |
|
16 | - * |
|
17 | - * @var integer |
|
18 | - */ |
|
19 | - protected $code = 410; |
|
14 | + /** |
|
15 | + * HTTP status code |
|
16 | + * |
|
17 | + * @var integer |
|
18 | + */ |
|
19 | + protected $code = 410; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Reason phrase |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $reason = 'Gone'; |
|
21 | + /** |
|
22 | + * Reason phrase |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $reason = 'Gone'; |
|
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -11,17 +11,17 @@ |
||
11 | 11 | * @package Requests |
12 | 12 | */ |
13 | 13 | class Requests_Exception_HTTP_504 extends Requests_Exception_HTTP { |
14 | - /** |
|
15 | - * HTTP status code |
|
16 | - * |
|
17 | - * @var integer |
|
18 | - */ |
|
19 | - protected $code = 504; |
|
14 | + /** |
|
15 | + * HTTP status code |
|
16 | + * |
|
17 | + * @var integer |
|
18 | + */ |
|
19 | + protected $code = 504; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Reason phrase |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $reason = 'Gateway Timeout'; |
|
21 | + /** |
|
22 | + * Reason phrase |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $reason = 'Gateway Timeout'; |
|
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -11,17 +11,17 @@ |
||
11 | 11 | * @package Requests |
12 | 12 | */ |
13 | 13 | class Requests_Exception_HTTP_406 extends Requests_Exception_HTTP { |
14 | - /** |
|
15 | - * HTTP status code |
|
16 | - * |
|
17 | - * @var integer |
|
18 | - */ |
|
19 | - protected $code = 406; |
|
14 | + /** |
|
15 | + * HTTP status code |
|
16 | + * |
|
17 | + * @var integer |
|
18 | + */ |
|
19 | + protected $code = 406; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Reason phrase |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $reason = 'Not Acceptable'; |
|
21 | + /** |
|
22 | + * Reason phrase |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $reason = 'Not Acceptable'; |
|
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -11,17 +11,17 @@ |
||
11 | 11 | * @package Requests |
12 | 12 | */ |
13 | 13 | class Requests_Exception_HTTP_502 extends Requests_Exception_HTTP { |
14 | - /** |
|
15 | - * HTTP status code |
|
16 | - * |
|
17 | - * @var integer |
|
18 | - */ |
|
19 | - protected $code = 502; |
|
14 | + /** |
|
15 | + * HTTP status code |
|
16 | + * |
|
17 | + * @var integer |
|
18 | + */ |
|
19 | + protected $code = 502; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Reason phrase |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $reason = 'Bad Gateway'; |
|
21 | + /** |
|
22 | + * Reason phrase |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $reason = 'Bad Gateway'; |
|
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -13,17 +13,17 @@ |
||
13 | 13 | * @package Requests |
14 | 14 | */ |
15 | 15 | class Requests_Exception_HTTP_511 extends Requests_Exception_HTTP { |
16 | - /** |
|
17 | - * HTTP status code |
|
18 | - * |
|
19 | - * @var integer |
|
20 | - */ |
|
21 | - protected $code = 511; |
|
16 | + /** |
|
17 | + * HTTP status code |
|
18 | + * |
|
19 | + * @var integer |
|
20 | + */ |
|
21 | + protected $code = 511; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Reason phrase |
|
25 | - * |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - protected $reason = 'Network Authentication Required'; |
|
23 | + /** |
|
24 | + * Reason phrase |
|
25 | + * |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + protected $reason = 'Network Authentication Required'; |
|
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -13,17 +13,17 @@ |
||
13 | 13 | * @package Requests |
14 | 14 | */ |
15 | 15 | class Requests_Exception_HTTP_418 extends Requests_Exception_HTTP { |
16 | - /** |
|
17 | - * HTTP status code |
|
18 | - * |
|
19 | - * @var integer |
|
20 | - */ |
|
21 | - protected $code = 418; |
|
16 | + /** |
|
17 | + * HTTP status code |
|
18 | + * |
|
19 | + * @var integer |
|
20 | + */ |
|
21 | + protected $code = 418; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Reason phrase |
|
25 | - * |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - protected $reason = "I'm A Teapot"; |
|
23 | + /** |
|
24 | + * Reason phrase |
|
25 | + * |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + protected $reason = "I'm A Teapot"; |
|
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -11,17 +11,17 @@ |
||
11 | 11 | * @package Requests |
12 | 12 | */ |
13 | 13 | class Requests_Exception_HTTP_405 extends Requests_Exception_HTTP { |
14 | - /** |
|
15 | - * HTTP status code |
|
16 | - * |
|
17 | - * @var integer |
|
18 | - */ |
|
19 | - protected $code = 405; |
|
14 | + /** |
|
15 | + * HTTP status code |
|
16 | + * |
|
17 | + * @var integer |
|
18 | + */ |
|
19 | + protected $code = 405; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Reason phrase |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $reason = 'Method Not Allowed'; |
|
21 | + /** |
|
22 | + * Reason phrase |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $reason = 'Method Not Allowed'; |
|
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -11,61 +11,61 @@ |
||
11 | 11 | * @package Requests |
12 | 12 | */ |
13 | 13 | class Requests_Exception_HTTP extends Requests_Exception { |
14 | - /** |
|
15 | - * HTTP status code |
|
16 | - * |
|
17 | - * @var integer |
|
18 | - */ |
|
19 | - protected $code = 0; |
|
14 | + /** |
|
15 | + * HTTP status code |
|
16 | + * |
|
17 | + * @var integer |
|
18 | + */ |
|
19 | + protected $code = 0; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Reason phrase |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $reason = 'Unknown'; |
|
21 | + /** |
|
22 | + * Reason phrase |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $reason = 'Unknown'; |
|
27 | 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) { |
|
38 | - if ($reason !== null) { |
|
39 | - $this->reason = $reason; |
|
40 | - } |
|
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) { |
|
38 | + if ($reason !== null) { |
|
39 | + $this->reason = $reason; |
|
40 | + } |
|
41 | 41 | |
42 | - $message = sprintf('%d %s', $this->code, $this->reason); |
|
43 | - parent::__construct($message, 'httpresponse', $data, $this->code); |
|
44 | - } |
|
42 | + $message = sprintf('%d %s', $this->code, $this->reason); |
|
43 | + parent::__construct($message, 'httpresponse', $data, $this->code); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Get the status message |
|
48 | - */ |
|
49 | - public function getReason() { |
|
50 | - return $this->reason; |
|
51 | - } |
|
46 | + /** |
|
47 | + * Get the status message |
|
48 | + */ |
|
49 | + public function getReason() { |
|
50 | + return $this->reason; |
|
51 | + } |
|
52 | 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) { |
|
60 | - if (!$code) { |
|
61 | - return 'Requests_Exception_HTTP_Unknown'; |
|
62 | - } |
|
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) { |
|
60 | + if (!$code) { |
|
61 | + return 'Requests_Exception_HTTP_Unknown'; |
|
62 | + } |
|
63 | 63 | |
64 | - $class = sprintf('Requests_Exception_HTTP_%d', $code); |
|
65 | - if (class_exists($class)) { |
|
66 | - return $class; |
|
67 | - } |
|
64 | + $class = sprintf('Requests_Exception_HTTP_%d', $code); |
|
65 | + if (class_exists($class)) { |
|
66 | + return $class; |
|
67 | + } |
|
68 | 68 | |
69 | - return 'Requests_Exception_HTTP_Unknown'; |
|
70 | - } |
|
69 | + return 'Requests_Exception_HTTP_Unknown'; |
|
70 | + } |
|
71 | 71 | } |
72 | 72 | \ No newline at end of file |
@@ -2,55 +2,55 @@ |
||
2 | 2 | |
3 | 3 | class Requests_Exception_Transport_cURL extends Requests_Exception_Transport { |
4 | 4 | |
5 | - const EASY = 'cURLEasy'; |
|
6 | - const MULTI = 'cURLMulti'; |
|
7 | - const SHARE = 'cURLShare'; |
|
8 | - |
|
9 | - /** |
|
10 | - * cURL error code |
|
11 | - * |
|
12 | - * @var integer |
|
13 | - */ |
|
14 | - protected $code = -1; |
|
15 | - |
|
16 | - /** |
|
17 | - * Which type of cURL error |
|
18 | - * |
|
19 | - * EASY|MULTI|SHARE |
|
20 | - * |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - protected $type = 'Unknown'; |
|
24 | - |
|
25 | - /** |
|
26 | - * Clear text error message |
|
27 | - * |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - protected $reason = 'Unknown'; |
|
31 | - |
|
32 | - public function __construct($message, $type, $data = null, $code = 0) { |
|
33 | - if ($type !== null) { |
|
34 | - $this->type = $type; |
|
35 | - } |
|
36 | - |
|
37 | - if ($code !== null) { |
|
38 | - $this->code = $code; |
|
39 | - } |
|
40 | - |
|
41 | - if ($message !== null) { |
|
42 | - $this->reason = $message; |
|
43 | - } |
|
44 | - |
|
45 | - $message = sprintf('%d %s', $this->code, $this->reason); |
|
46 | - parent::__construct($message, $this->type, $data, $this->code); |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * Get the error message |
|
51 | - */ |
|
52 | - public function getReason() { |
|
53 | - return $this->reason; |
|
54 | - } |
|
5 | + const EASY = 'cURLEasy'; |
|
6 | + const MULTI = 'cURLMulti'; |
|
7 | + const SHARE = 'cURLShare'; |
|
8 | + |
|
9 | + /** |
|
10 | + * cURL error code |
|
11 | + * |
|
12 | + * @var integer |
|
13 | + */ |
|
14 | + protected $code = -1; |
|
15 | + |
|
16 | + /** |
|
17 | + * Which type of cURL error |
|
18 | + * |
|
19 | + * EASY|MULTI|SHARE |
|
20 | + * |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + protected $type = 'Unknown'; |
|
24 | + |
|
25 | + /** |
|
26 | + * Clear text error message |
|
27 | + * |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + protected $reason = 'Unknown'; |
|
31 | + |
|
32 | + public function __construct($message, $type, $data = null, $code = 0) { |
|
33 | + if ($type !== null) { |
|
34 | + $this->type = $type; |
|
35 | + } |
|
36 | + |
|
37 | + if ($code !== null) { |
|
38 | + $this->code = $code; |
|
39 | + } |
|
40 | + |
|
41 | + if ($message !== null) { |
|
42 | + $this->reason = $message; |
|
43 | + } |
|
44 | + |
|
45 | + $message = sprintf('%d %s', $this->code, $this->reason); |
|
46 | + parent::__construct($message, $this->type, $data, $this->code); |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * Get the error message |
|
51 | + */ |
|
52 | + public function getReason() { |
|
53 | + return $this->reason; |
|
54 | + } |
|
55 | 55 | |
56 | 56 | } |