@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | throw new Exception($this->testMessage, $this->testCode); |
17 | 17 | } |
18 | - catch(Exception $e) |
|
18 | + catch (Exception $e) |
|
19 | 19 | { |
20 | 20 | $this->assertEquals($e->getMessage(), $this->testMessage); |
21 | 21 | $this->assertEquals($e->getCode(), $this->testCode); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * |
29 | 29 | * @access public |
30 | 30 | */ |
31 | - public function __construct( $auth_string = '' ) |
|
31 | + public function __construct($auth_string = '') |
|
32 | 32 | { |
33 | 33 | $client = new Client($auth_string); |
34 | 34 | $this->request = new Request($client); |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @access public |
33 | 33 | */ |
34 | - public function __construct( $auth_string = '' ) |
|
34 | + public function __construct($auth_string = '') |
|
35 | 35 | { |
36 | 36 | // Check if lib cURL is enabled |
37 | - if (!function_exists('curl_init') ) { |
|
37 | + if (!function_exists('curl_init')) { |
|
38 | 38 | throw new Exception('Lib cURL must be enabled on the server'); |
39 | 39 | } |
40 | 40 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function shutdown() |
56 | 56 | { |
57 | - if (!empty($this->ch) ) { |
|
57 | + if (!empty($this->ch)) { |
|
58 | 58 | curl_close($this->ch); |
59 | 59 | } |
60 | 60 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @access public |
30 | 30 | * @return object |
31 | 31 | */ |
32 | - public function __construct( $client ) |
|
32 | + public function __construct($client) |
|
33 | 33 | { |
34 | 34 | $this->client = $client; |
35 | 35 | } |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | * @param array $query |
45 | 45 | * @return Response |
46 | 46 | */ |
47 | - public function get( $path, $query = array() ) |
|
47 | + public function get($path, $query = array()) |
|
48 | 48 | { |
49 | 49 | // Add query parameters to $path? |
50 | 50 | if ($query) { |
51 | - if (strpos($path, '?') === false ) { |
|
51 | + if (strpos($path, '?') === false) { |
|
52 | 52 | $path .= '?' . http_build_query($query); |
53 | 53 | } else { |
54 | 54 | $path .= ini_get('arg_separator.output') . http_build_query($query); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @access public |
71 | 71 | * @return Response |
72 | 72 | */ |
73 | - public function post( $path, $form = array() ) |
|
73 | + public function post($path, $form = array()) |
|
74 | 74 | { |
75 | 75 | // Set the request params |
76 | 76 | $this->set_url($path); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @access public |
88 | 88 | * @return Response |
89 | 89 | */ |
90 | - public function put( $path, $form = array() ) |
|
90 | + public function put($path, $form = array()) |
|
91 | 91 | { |
92 | 92 | // Set the request params |
93 | 93 | $this->set_url($path); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @access public |
105 | 105 | * @return Response |
106 | 106 | */ |
107 | - public function patch( $path, $form = array() ) |
|
107 | + public function patch($path, $form = array()) |
|
108 | 108 | { |
109 | 109 | // Set the request params |
110 | 110 | $this->set_url($path); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @access public |
122 | 122 | * @return Response |
123 | 123 | */ |
124 | - public function delete( $path, $form = array() ) |
|
124 | + public function delete($path, $form = array()) |
|
125 | 125 | { |
126 | 126 | // Set the request params |
127 | 127 | $this->set_url($path); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @access protected |
139 | 139 | * @return void |
140 | 140 | */ |
141 | - protected function set_url( $params ) |
|
141 | + protected function set_url($params) |
|
142 | 142 | { |
143 | 143 | curl_setopt($this->client->ch, CURLOPT_URL, Constants::API_URL . trim($params, '/')); |
144 | 144 | } |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | * @param array $form |
154 | 154 | * @return Response |
155 | 155 | */ |
156 | - protected function execute( $request_type, $form = array() ) |
|
156 | + protected function execute($request_type, $form = array()) |
|
157 | 157 | { |
158 | 158 | // Set the HTTP request type |
159 | 159 | curl_setopt($this->client->ch, CURLOPT_CUSTOMREQUEST, $request_type); |
160 | 160 | |
161 | 161 | // If additional data is delivered, we will send it along with the API request |
162 | - if (is_array($form) && ! empty($form)) { |
|
162 | + if (is_array($form) && !empty($form)) { |
|
163 | 163 | curl_setopt($this->client->ch, CURLOPT_POSTFIELDS, http_build_query($form)); |
164 | 164 | } |
165 | 165 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param string $received_headers the headers received |
49 | 49 | * @param string $response_data the http response body |
50 | 50 | */ |
51 | - public function __construct( $status_code, $sent_headers, $received_headers, $response_data ) |
|
51 | + public function __construct($status_code, $sent_headers, $received_headers, $response_data) |
|
52 | 52 | { |
53 | 53 | $this->status_code = $status_code; |
54 | 54 | $this->sent_headers = $sent_headers; |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | * @param boolan $keep_authorization_value Normally the value of the Authorization: header is masked. True keeps the sent value. |
67 | 67 | * @return array [integer, string[], string] |
68 | 68 | */ |
69 | - public function as_raw( $keep_authorization_value = false ) |
|
69 | + public function as_raw($keep_authorization_value = false) |
|
70 | 70 | { |
71 | 71 | // To avoid unintentional logging of credentials the default is to mask the value of the Authorization: header |
72 | - if ($keep_authorization_value ) { |
|
72 | + if ($keep_authorization_value) { |
|
73 | 73 | $sent_headers = $this->sent_headers; |
74 | 74 | } else { |
75 | 75 | // Avoid dependency on mbstring |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function as_array() |
102 | 102 | { |
103 | - if ($response = json_decode($this->response_data, true) ) { |
|
103 | + if ($response = json_decode($this->response_data, true)) { |
|
104 | 104 | return $response; |
105 | 105 | } |
106 | 106 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function as_object() |
118 | 118 | { |
119 | - if ($response = json_decode($this->response_data) ) { |
|
119 | + if ($response = json_decode($this->response_data)) { |
|
120 | 120 | return $response; |
121 | 121 | } |
122 | 122 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function is_success() |
146 | 146 | { |
147 | - if ($this->status_code > 299 ) { |
|
147 | + if ($this->status_code > 299) { |
|
148 | 148 | return false; |
149 | 149 | } |
150 | 150 |