@@ -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 | } |
@@ -17,135 +17,135 @@ |
||
17 | 17 | * @since 1.6 |
18 | 18 | */ |
19 | 19 | class Requests_Proxy_HTTP implements Requests_Proxy { |
20 | - /** |
|
21 | - * Proxy host and port |
|
22 | - * |
|
23 | - * Notation: "host:port" (eg 127.0.0.1:8080 or someproxy.com:3128) |
|
24 | - * |
|
25 | - * @var string |
|
26 | - */ |
|
27 | - public $proxy; |
|
20 | + /** |
|
21 | + * Proxy host and port |
|
22 | + * |
|
23 | + * Notation: "host:port" (eg 127.0.0.1:8080 or someproxy.com:3128) |
|
24 | + * |
|
25 | + * @var string |
|
26 | + */ |
|
27 | + public $proxy; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Username |
|
31 | - * |
|
32 | - * @var string |
|
33 | - */ |
|
34 | - public $user; |
|
29 | + /** |
|
30 | + * Username |
|
31 | + * |
|
32 | + * @var string |
|
33 | + */ |
|
34 | + public $user; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Password |
|
38 | - * |
|
39 | - * @var string |
|
40 | - */ |
|
41 | - public $pass; |
|
36 | + /** |
|
37 | + * Password |
|
38 | + * |
|
39 | + * @var string |
|
40 | + */ |
|
41 | + public $pass; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Do we need to authenticate? (ie username & password have been provided) |
|
45 | - * |
|
46 | - * @var boolean |
|
47 | - */ |
|
48 | - public $use_authentication; |
|
43 | + /** |
|
44 | + * Do we need to authenticate? (ie username & password have been provided) |
|
45 | + * |
|
46 | + * @var boolean |
|
47 | + */ |
|
48 | + public $use_authentication; |
|
49 | 49 | |
50 | - /** |
|
51 | - * Constructor |
|
52 | - * |
|
53 | - * @since 1.6 |
|
54 | - * @throws Requests_Exception On incorrect number of arguments (`authbasicbadargs`) |
|
55 | - * @param array|null $args Array of user and password. Must have exactly two elements |
|
56 | - */ |
|
57 | - public function __construct($args = null) { |
|
58 | - if (is_string($args)) { |
|
59 | - $this->proxy = $args; |
|
60 | - } |
|
61 | - elseif (is_array($args)) { |
|
62 | - if (count($args) == 1) { |
|
63 | - list($this->proxy) = $args; |
|
64 | - } |
|
65 | - elseif (count($args) == 3) { |
|
66 | - list($this->proxy, $this->user, $this->pass) = $args; |
|
67 | - $this->use_authentication = true; |
|
68 | - } |
|
69 | - else { |
|
70 | - throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs'); |
|
71 | - } |
|
72 | - } |
|
73 | - } |
|
50 | + /** |
|
51 | + * Constructor |
|
52 | + * |
|
53 | + * @since 1.6 |
|
54 | + * @throws Requests_Exception On incorrect number of arguments (`authbasicbadargs`) |
|
55 | + * @param array|null $args Array of user and password. Must have exactly two elements |
|
56 | + */ |
|
57 | + public function __construct($args = null) { |
|
58 | + if (is_string($args)) { |
|
59 | + $this->proxy = $args; |
|
60 | + } |
|
61 | + elseif (is_array($args)) { |
|
62 | + if (count($args) == 1) { |
|
63 | + list($this->proxy) = $args; |
|
64 | + } |
|
65 | + elseif (count($args) == 3) { |
|
66 | + list($this->proxy, $this->user, $this->pass) = $args; |
|
67 | + $this->use_authentication = true; |
|
68 | + } |
|
69 | + else { |
|
70 | + throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs'); |
|
71 | + } |
|
72 | + } |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Register the necessary callbacks |
|
77 | - * |
|
78 | - * @since 1.6 |
|
79 | - * @see curl_before_send |
|
80 | - * @see fsockopen_remote_socket |
|
81 | - * @see fsockopen_remote_host_path |
|
82 | - * @see fsockopen_header |
|
83 | - * @param Requests_Hooks $hooks Hook system |
|
84 | - */ |
|
85 | - public function register(Requests_Hooks &$hooks) { |
|
86 | - $hooks->register('curl.before_send', array(&$this, 'curl_before_send')); |
|
75 | + /** |
|
76 | + * Register the necessary callbacks |
|
77 | + * |
|
78 | + * @since 1.6 |
|
79 | + * @see curl_before_send |
|
80 | + * @see fsockopen_remote_socket |
|
81 | + * @see fsockopen_remote_host_path |
|
82 | + * @see fsockopen_header |
|
83 | + * @param Requests_Hooks $hooks Hook system |
|
84 | + */ |
|
85 | + public function register(Requests_Hooks &$hooks) { |
|
86 | + $hooks->register('curl.before_send', array(&$this, 'curl_before_send')); |
|
87 | 87 | |
88 | - $hooks->register('fsockopen.remote_socket', array(&$this, 'fsockopen_remote_socket')); |
|
89 | - $hooks->register('fsockopen.remote_host_path', array(&$this, 'fsockopen_remote_host_path')); |
|
90 | - if ($this->use_authentication) { |
|
91 | - $hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header')); |
|
92 | - } |
|
93 | - } |
|
88 | + $hooks->register('fsockopen.remote_socket', array(&$this, 'fsockopen_remote_socket')); |
|
89 | + $hooks->register('fsockopen.remote_host_path', array(&$this, 'fsockopen_remote_host_path')); |
|
90 | + if ($this->use_authentication) { |
|
91 | + $hooks->register('fsockopen.after_headers', array(&$this, 'fsockopen_header')); |
|
92 | + } |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * Set cURL parameters before the data is sent |
|
97 | - * |
|
98 | - * @since 1.6 |
|
99 | - * @param resource $handle cURL resource |
|
100 | - */ |
|
101 | - public function curl_before_send(&$handle) { |
|
102 | - curl_setopt($handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); |
|
103 | - curl_setopt($handle, CURLOPT_PROXY, $this->proxy); |
|
95 | + /** |
|
96 | + * Set cURL parameters before the data is sent |
|
97 | + * |
|
98 | + * @since 1.6 |
|
99 | + * @param resource $handle cURL resource |
|
100 | + */ |
|
101 | + public function curl_before_send(&$handle) { |
|
102 | + curl_setopt($handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); |
|
103 | + curl_setopt($handle, CURLOPT_PROXY, $this->proxy); |
|
104 | 104 | |
105 | - if ($this->use_authentication) { |
|
106 | - curl_setopt($handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY); |
|
107 | - curl_setopt($handle, CURLOPT_PROXYUSERPWD, $this->get_auth_string()); |
|
108 | - } |
|
109 | - } |
|
105 | + if ($this->use_authentication) { |
|
106 | + curl_setopt($handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY); |
|
107 | + curl_setopt($handle, CURLOPT_PROXYUSERPWD, $this->get_auth_string()); |
|
108 | + } |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * Alter remote socket information before opening socket connection |
|
113 | - * |
|
114 | - * @since 1.6 |
|
115 | - * @param string $remote_socket Socket connection string |
|
116 | - */ |
|
117 | - public function fsockopen_remote_socket(&$remote_socket) { |
|
118 | - $remote_socket = $this->proxy; |
|
119 | - } |
|
111 | + /** |
|
112 | + * Alter remote socket information before opening socket connection |
|
113 | + * |
|
114 | + * @since 1.6 |
|
115 | + * @param string $remote_socket Socket connection string |
|
116 | + */ |
|
117 | + public function fsockopen_remote_socket(&$remote_socket) { |
|
118 | + $remote_socket = $this->proxy; |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * Alter remote path before getting stream data |
|
123 | - * |
|
124 | - * @since 1.6 |
|
125 | - * @param string $path Path to send in HTTP request string ("GET ...") |
|
126 | - * @param string $url Full URL we're requesting |
|
127 | - */ |
|
128 | - public function fsockopen_remote_host_path(&$path, $url) { |
|
129 | - $path = $url; |
|
130 | - } |
|
121 | + /** |
|
122 | + * Alter remote path before getting stream data |
|
123 | + * |
|
124 | + * @since 1.6 |
|
125 | + * @param string $path Path to send in HTTP request string ("GET ...") |
|
126 | + * @param string $url Full URL we're requesting |
|
127 | + */ |
|
128 | + public function fsockopen_remote_host_path(&$path, $url) { |
|
129 | + $path = $url; |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * Add extra headers to the request before sending |
|
134 | - * |
|
135 | - * @since 1.6 |
|
136 | - * @param string $out HTTP header string |
|
137 | - */ |
|
138 | - public function fsockopen_header(&$out) { |
|
139 | - $out .= sprintf("Proxy-Authorization: Basic %s\r\n", base64_encode($this->get_auth_string())); |
|
140 | - } |
|
132 | + /** |
|
133 | + * Add extra headers to the request before sending |
|
134 | + * |
|
135 | + * @since 1.6 |
|
136 | + * @param string $out HTTP header string |
|
137 | + */ |
|
138 | + public function fsockopen_header(&$out) { |
|
139 | + $out .= sprintf("Proxy-Authorization: Basic %s\r\n", base64_encode($this->get_auth_string())); |
|
140 | + } |
|
141 | 141 | |
142 | - /** |
|
143 | - * Get the authentication string (user:pass) |
|
144 | - * |
|
145 | - * @since 1.6 |
|
146 | - * @return string |
|
147 | - */ |
|
148 | - public function get_auth_string() { |
|
149 | - return $this->user . ':' . $this->pass; |
|
150 | - } |
|
142 | + /** |
|
143 | + * Get the authentication string (user:pass) |
|
144 | + * |
|
145 | + * @since 1.6 |
|
146 | + * @return string |
|
147 | + */ |
|
148 | + public function get_auth_string() { |
|
149 | + return $this->user . ':' . $this->pass; |
|
150 | + } |
|
151 | 151 | } |
152 | 152 | \ No newline at end of file |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @see fsockopen_header |
83 | 83 | * @param Requests_Hooks $hooks Hook system |
84 | 84 | */ |
85 | - public function register(Requests_Hooks &$hooks) { |
|
85 | + public function register(Requests_Hooks & $hooks) { |
|
86 | 86 | $hooks->register('curl.before_send', array(&$this, 'curl_before_send')); |
87 | 87 | |
88 | 88 | $hooks->register('fsockopen.remote_socket', array(&$this, 'fsockopen_remote_socket')); |
@@ -146,6 +146,6 @@ discard block |
||
146 | 146 | * @return string |
147 | 147 | */ |
148 | 148 | public function get_auth_string() { |
149 | - return $this->user . ':' . $this->pass; |
|
149 | + return $this->user.':'.$this->pass; |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | \ No newline at end of file |
@@ -57,16 +57,13 @@ |
||
57 | 57 | public function __construct($args = null) { |
58 | 58 | if (is_string($args)) { |
59 | 59 | $this->proxy = $args; |
60 | - } |
|
61 | - elseif (is_array($args)) { |
|
60 | + } elseif (is_array($args)) { |
|
62 | 61 | if (count($args) == 1) { |
63 | 62 | list($this->proxy) = $args; |
64 | - } |
|
65 | - elseif (count($args) == 3) { |
|
63 | + } elseif (count($args) == 3) { |
|
66 | 64 | list($this->proxy, $this->user, $this->pass) = $args; |
67 | 65 | $this->use_authentication = true; |
68 | - } |
|
69 | - else { |
|
66 | + } else { |
|
70 | 67 | throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs'); |
71 | 68 | } |
72 | 69 | } |
@@ -19,15 +19,15 @@ |
||
19 | 19 | * @subpackage Authentication |
20 | 20 | */ |
21 | 21 | interface Requests_Auth { |
22 | - /** |
|
23 | - * Register hooks as needed |
|
24 | - * |
|
25 | - * This method is called in {@see Requests::request} when the user has set |
|
26 | - * an instance as the 'auth' option. Use this callback to register all the |
|
27 | - * hooks you'll need. |
|
28 | - * |
|
29 | - * @see Requests_Hooks::register |
|
30 | - * @param Requests_Hooks $hooks Hook system |
|
31 | - */ |
|
32 | - public function register(Requests_Hooks &$hooks); |
|
22 | + /** |
|
23 | + * Register hooks as needed |
|
24 | + * |
|
25 | + * This method is called in {@see Requests::request} when the user has set |
|
26 | + * an instance as the 'auth' option. Use this callback to register all the |
|
27 | + * hooks you'll need. |
|
28 | + * |
|
29 | + * @see Requests_Hooks::register |
|
30 | + * @param Requests_Hooks $hooks Hook system |
|
31 | + */ |
|
32 | + public function register(Requests_Hooks &$hooks); |
|
33 | 33 | } |
34 | 34 | \ No newline at end of file |
@@ -29,5 +29,5 @@ |
||
29 | 29 | * @see Requests_Hooks::register |
30 | 30 | * @param Requests_Hooks $hooks Hook system |
31 | 31 | */ |
32 | - public function register(Requests_Hooks &$hooks); |
|
32 | + public function register(Requests_Hooks & $hooks); |
|
33 | 33 | } |
34 | 34 | \ No newline at end of file |