diff --git a/examples/multiple.php b/examples/multiple.php index abce996ca..fc2d98fac 100644 --- a/examples/multiple.php +++ b/examples/multiple.php @@ -9,15 +9,15 @@ // Setup what we want to request $requests = array( array( - 'url' => 'http://httpbin.org/get', + 'url' => 'http://httpbin.org/get', 'headers' => array('Accept' => 'application/javascript'), ), - 'post' => array( - 'url' => 'http://httpbin.org/post', + 'post' => array( + 'url' => 'http://httpbin.org/post', 'data' => array('mydata' => 'something'), ), 'delayed' => array( - 'url' => 'http://httpbin.org/delay/10', + 'url' => 'http://httpbin.org/delay/10', 'options' => array( 'timeout' => 20, ), diff --git a/library/Requests.php b/library/Requests.php index 916014d19..e3665bc30 100644 --- a/library/Requests.php +++ b/library/Requests.php @@ -503,25 +503,25 @@ public static function request_multiple($requests, $options = array()) { */ protected static function get_default_options($multirequest = false) { $defaults = array( - 'timeout' => 10, - 'connect_timeout' => 10, - 'useragent' => 'php-requests/' . self::VERSION, + 'timeout' => 10, + 'connect_timeout' => 10, + 'useragent' => 'php-requests/' . self::VERSION, 'protocol_version' => 1.1, - 'redirected' => 0, - 'redirects' => 10, + 'redirected' => 0, + 'redirects' => 10, 'follow_redirects' => true, - 'blocking' => true, - 'type' => self::GET, - 'filename' => false, - 'auth' => false, - 'proxy' => false, - 'cookies' => false, - 'max_bytes' => false, - 'idn' => true, - 'hooks' => null, - 'transport' => null, - 'verify' => Requests::get_certificate_path(), - 'verifyname' => true, + 'blocking' => true, + 'type' => self::GET, + 'filename' => false, + 'auth' => false, + 'proxy' => false, + 'cookies' => false, + 'max_bytes' => false, + 'idn' => true, + 'hooks' => null, + 'transport' => null, + 'verify' => Requests::get_certificate_path(), + 'verifyname' => true, ); if ($multirequest !== false) { $defaults['complete'] = null; diff --git a/library/Requests/Cookie.php b/library/Requests/Cookie.php index bd1ad37f0..7dd5b6822 100644 --- a/library/Requests/Cookie.php +++ b/library/Requests/Cookie.php @@ -69,10 +69,10 @@ public function __construct($name, $value, $attributes = array(), $flags = array $this->value = $value; $this->attributes = $attributes; $default_flags = array( - 'creation' => time(), + 'creation' => time(), 'last-access' => time(), - 'persistent' => false, - 'host-only' => true, + 'persistent' => false, + 'host-only' => true, ); $this->flags = array_merge($default_flags, $flags); diff --git a/library/Requests/Transport/fsockopen.php b/library/Requests/Transport/fsockopen.php index ce25ac2a4..4d18b9d88 100644 --- a/library/Requests/Transport/fsockopen.php +++ b/library/Requests/Transport/fsockopen.php @@ -75,7 +75,7 @@ public function request($url, $headers = array(), $data = array(), $options = ar } $context_options = array( - 'verify_peer' => true, + 'verify_peer' => true, // 'CN_match' => $host, 'capture_peer_cert' => true ); diff --git a/tests/Auth/Basic.php b/tests/Auth/Basic.php index a92032861..b7240f46d 100644 --- a/tests/Auth/Basic.php +++ b/tests/Auth/Basic.php @@ -19,7 +19,7 @@ public function testUsingArray($transport) { } $options = array( - 'auth' => array('user', 'passwd'), + 'auth' => array('user', 'passwd'), 'transport' => $transport, ); $request = Requests::get(httpbin('/basic-auth/user/passwd'), array(), $options); @@ -40,7 +40,7 @@ public function testUsingInstantiation($transport) { } $options = array( - 'auth' => new Requests_Auth_Basic(array('user', 'passwd')), + 'auth' => new Requests_Auth_Basic(array('user', 'passwd')), 'transport' => $transport, ); $request = Requests::get(httpbin('/basic-auth/user/passwd'), array(), $options); @@ -61,7 +61,7 @@ public function testPOSTUsingInstantiation($transport) { } $options = array( - 'auth' => new Requests_Auth_Basic(array('user', 'passwd')), + 'auth' => new Requests_Auth_Basic(array('user', 'passwd')), 'transport' => $transport, ); $data = 'test'; diff --git a/tests/ChunkedEncoding.php b/tests/ChunkedEncoding.php index 7229ccab1..acf4ea2f2 100644 --- a/tests/ChunkedEncoding.php +++ b/tests/ChunkedEncoding.php @@ -48,11 +48,11 @@ public function testChunked($body, $expected) { public static function notChunkedProvider() { return array( - 'invalid chunk size' => array('Hello! This is a non-chunked response!'), - 'invalid chunk extension' => array('1BNot chunked\r\nLooks chunked but it is not\r\n'), - 'unquoted chunk-ext-val with space' => array("02;foo=unquoted with space\r\nab\r\n04\r\nra\nc\r\n06\r\nadabra\r\n0c\r\n\nall we got\n"), + 'invalid chunk size' => array('Hello! This is a non-chunked response!'), + 'invalid chunk extension' => array('1BNot chunked\r\nLooks chunked but it is not\r\n'), + 'unquoted chunk-ext-val with space' => array("02;foo=unquoted with space\r\nab\r\n04\r\nra\nc\r\n06\r\nadabra\r\n0c\r\n\nall we got\n"), 'unquoted chunk-ext-val with forbidden character' => array("02;foo={unquoted}\r\nab\r\n04\r\nra\nc\r\n06\r\nadabra\r\n0c\r\n\nall we got\n"), - 'invalid chunk-ext-name' => array("02;{foo}=bar\r\nab\r\n04\r\nra\nc\r\n06\r\nadabra\r\n0c\r\n\nall we got\n"), + 'invalid chunk-ext-name' => array("02;{foo}=bar\r\nab\r\n04\r\nra\nc\r\n06\r\nadabra\r\n0c\r\n\nall we got\n"), 'incomplete quote for chunk-ext-value' => array("02;foo=\"no end quote\r\nab\r\n04\r\nra\nc\r\n06\r\nadabra\r\n0c\r\n\nall we got\n"), ); } diff --git a/tests/Proxy/HTTP.php b/tests/Proxy/HTTP.php index bd35a76e9..37d77962b 100644 --- a/tests/Proxy/HTTP.php +++ b/tests/Proxy/HTTP.php @@ -31,7 +31,7 @@ public function testConnectWithString($transport) { $this->checkProxyAvailable(); $options = array( - 'proxy' => REQUESTS_HTTP_PROXY, + 'proxy' => REQUESTS_HTTP_PROXY, 'transport' => $transport, ); $response = Requests::get(httpbin('/get'), array(), $options); @@ -48,7 +48,7 @@ public function testConnectWithArray($transport) { $this->checkProxyAvailable(); $options = array( - 'proxy' => array(REQUESTS_HTTP_PROXY), + 'proxy' => array(REQUESTS_HTTP_PROXY), 'transport' => $transport, ); $response = Requests::get(httpbin('/get'), array(), $options); @@ -66,7 +66,7 @@ public function testConnectInvalidParameters($transport) { $this->checkProxyAvailable(); $options = array( - 'proxy' => array(REQUESTS_HTTP_PROXY, 'testuser', 'password', 'something'), + 'proxy' => array(REQUESTS_HTTP_PROXY, 'testuser', 'password', 'something'), 'transport' => $transport, ); $response = Requests::get(httpbin('/get'), array(), $options); @@ -79,7 +79,7 @@ public function testConnectWithInstance($transport) { $this->checkProxyAvailable(); $options = array( - 'proxy' => new Requests_Proxy_HTTP(REQUESTS_HTTP_PROXY), + 'proxy' => new Requests_Proxy_HTTP(REQUESTS_HTTP_PROXY), 'transport' => $transport, ); $response = Requests::get(httpbin('/get'), array(), $options); @@ -96,7 +96,7 @@ public function testConnectWithAuth($transport) { $this->checkProxyAvailable('auth'); $options = array( - 'proxy' => array( + 'proxy' => array( REQUESTS_HTTP_PROXY_AUTH, REQUESTS_HTTP_PROXY_AUTH_USER, REQUESTS_HTTP_PROXY_AUTH_PASS @@ -118,7 +118,7 @@ public function testConnectWithInvalidAuth($transport) { $this->checkProxyAvailable('auth'); $options = array( - 'proxy' => array( + 'proxy' => array( REQUESTS_HTTP_PROXY_AUTH, REQUESTS_HTTP_PROXY_AUTH_USER . '!', REQUESTS_HTTP_PROXY_AUTH_PASS . '!' diff --git a/tests/Session.php b/tests/Session.php index 6bd6c837b..6f6b41a69 100644 --- a/tests/Session.php +++ b/tests/Session.php @@ -144,20 +144,20 @@ public function testMultiple() { public function testPropertyUsage() { $headers = array( - 'X-TestHeader' => 'testing', + 'X-TestHeader' => 'testing', 'X-TestHeader2' => 'requests-test' ); $data = array( 'testdata' => 'value1', - 'test2' => 'value2', - 'test3' => array( + 'test2' => 'value2', + 'test3' => array( 'foo' => 'bar', 'abc' => 'xyz' ) ); $options = array( 'testoption' => 'test', - 'foo' => 'bar' + 'foo' => 'bar' ); $session = new Requests_Session('http://example.com/', $headers, $data, $options); diff --git a/tests/Transport/Base.php b/tests/Transport/Base.php index 26eff607f..0b22beb1b 100644 --- a/tests/Transport/Base.php +++ b/tests/Transport/Base.php @@ -61,7 +61,7 @@ public function testResponseByteLimitWithFile() { $limit = 300; $options = array( 'max_bytes' => $limit, - 'filename' => tempnam(sys_get_temp_dir(), 'RLT') // RequestsLibraryTest + 'filename' => tempnam(sys_get_temp_dir(), 'RLT') // RequestsLibraryTest ); $response = Requests::get(httpbin('/bytes/482'), array(), $this->getOptions($options)); $this->assertEmpty($response->body); @@ -89,7 +89,7 @@ public function testGETWithArgs() { public function testGETWithData() { $data = array( - 'test' => 'true', + 'test' => 'true', 'test2' => 'test', ); $request = Requests::request(httpbin('/get'), array(), $data, Requests::GET, $this->getOptions()); @@ -102,7 +102,7 @@ public function testGETWithData() { public function testGETWithNestedData() { $data = array( - 'test' => 'true', + 'test' => 'true', 'test2' => array( 'test3' => 'test', 'test4' => 'test-too', @@ -179,7 +179,7 @@ public function testFormPost() { public function testPOSTWithArray() { $data = array( - 'test' => 'true', + 'test' => 'true', 'test2' => 'test', ); $request = Requests::post(httpbin('/post'), array(), $data, $this->getOptions()); @@ -191,7 +191,7 @@ public function testPOSTWithArray() { public function testPOSTWithNestedData() { $data = array( - 'test' => 'true', + 'test' => 'true', 'test2' => array( 'test3' => 'test', 'test4' => 'test-too', @@ -224,7 +224,7 @@ public function testFormPUT() { public function testPUTWithArray() { $data = array( - 'test' => 'true', + 'test' => 'true', 'test2' => 'test', ); $request = Requests::put(httpbin('/put'), array(), $data, $this->getOptions()); @@ -254,7 +254,7 @@ public function testFormPATCH() { public function testPATCHWithArray() { $data = array( - 'test' => 'true', + 'test' => 'true', 'test2' => 'test', ); $request = Requests::patch(httpbin('/patch'), array(), $data, $this->getOptions()); @@ -280,7 +280,7 @@ public function testDELETE() { public function testDELETEWithData() { $data = array( - 'test' => 'true', + 'test' => 'true', 'test2' => 'test', ); $request = Requests::request(httpbin('/delete'), array(), $data, Requests::DELETE, $this->getOptions()); @@ -298,7 +298,7 @@ public function testLOCK() { public function testLOCKWithData() { $data = array( - 'test' => 'true', + 'test' => 'true', 'test2' => 'test', ); $request = Requests::request(httpbin('/lock'), array(), $data, 'LOCK', $this->getOptions()); @@ -393,7 +393,7 @@ public function testStatusCode($code, $success) { $options = array( 'follow_redirects' => false, - 'transport' => $transport, + 'transport' => $transport, ); $request = Requests::get($url, array(), $options); $this->assertEquals($code, $request->status_code); @@ -410,7 +410,7 @@ public function testStatusCodeThrow($code, $success) { $url = sprintf(httpbin('/status/%d'), $code); $options = array( 'follow_redirects' => false, - 'transport' => $transport, + 'transport' => $transport, ); if (!$success) { @@ -435,7 +435,7 @@ public function testStatusCodeThrowAllowRedirects($code, $success) { $url = sprintf(httpbin('/status/%d'), $code); $options = array( 'follow_redirects' => false, - 'transport' => $transport, + 'transport' => $transport, ); if (!$success) { @@ -657,7 +657,7 @@ public function testMultipleWithDifferingMethods() { 'url' => httpbin('/get'), ), 'post' => array( - 'url' => httpbin('/post'), + 'url' => httpbin('/post'), 'type' => Requests::POST, 'data' => 'test', ), @@ -682,7 +682,7 @@ public function testMultipleWithFailure() { 'url' => httpbin('/get'), ), 'timeout' => array( - 'url' => httpbin('/delay/10'), + 'url' => httpbin('/delay/10'), 'options' => array( 'timeout' => 1, ), @@ -699,7 +699,7 @@ public function testMultipleUsingCallback() { 'url' => httpbin('/get'), ), 'post' => array( - 'url' => httpbin('/post'), + 'url' => httpbin('/post'), 'type' => Requests::POST, 'data' => 'test', ), @@ -720,7 +720,7 @@ public function testMultipleUsingCallbackAndFailure() { 'url' => httpbin('/get'), ), 'timeout' => array( - 'url' => httpbin('/delay/10'), + 'url' => httpbin('/delay/10'), 'options' => array( 'timeout' => 1, ), @@ -743,15 +743,15 @@ public function completeCallback($response, $key) { public function testMultipleToFile() { $requests = array( 'get' => array( - 'url' => httpbin('/get'), + 'url' => httpbin('/get'), 'options' => array( 'filename' => tempnam(sys_get_temp_dir(), 'RLT') // RequestsLibraryTest ), ), 'post' => array( - 'url' => httpbin('/post'), - 'type' => Requests::POST, - 'data' => 'test', + 'url' => httpbin('/post'), + 'type' => Requests::POST, + 'data' => 'test', 'options' => array( 'filename' => tempnam(sys_get_temp_dir(), 'RLT') // RequestsLibraryTest ),