@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function getActionsByResource($resource) |
164 | 164 | { |
165 | - if (!isset($this->resources[$resource])) { |
|
165 | + if (!isset($this->resources[ $resource ])) { |
|
166 | 166 | return null; // no resource found |
167 | 167 | } |
168 | 168 | |
169 | 169 | $actions = array(); |
170 | - foreach ($this->resources[$resource] as $action => $path) { |
|
171 | - $actions[] = $action; |
|
170 | + foreach ($this->resources[ $resource ] as $action => $path) { |
|
171 | + $actions[ ] = $action; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | return $actions; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function isMultiPartAction($resource, $action) |
200 | 200 | { |
201 | - return isset($this->multiPartActions[$resource]) && in_array($action, $this->multiPartActions[$resource]); |
|
201 | + return isset($this->multiPartActions[ $resource ]) && in_array($action, $this->multiPartActions[ $resource ]); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function isExportFileAction($resource, $action) |
211 | 211 | { |
212 | - return isset($this->exportFileActions[$resource]) && in_array($action, $this->exportFileActions[$resource]); |
|
212 | + return isset($this->exportFileActions[ $resource ]) && in_array($action, $this->exportFileActions[ $resource ]); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -275,23 +275,23 @@ discard block |
||
275 | 275 | */ |
276 | 276 | private function getRequestPath($resource, $action, &$params) |
277 | 277 | { |
278 | - if (!isset($this->resources[$resource]) || !isset($this->resources[$resource][$action])) { |
|
278 | + if (!isset($this->resources[ $resource ]) || !isset($this->resources[ $resource ][ $action ])) { |
|
279 | 279 | throw new \UnexpectedValueException('Resource path not found'); |
280 | 280 | } |
281 | 281 | |
282 | 282 | // get path |
283 | - $path = $this->resources[$resource][$action]; |
|
283 | + $path = $this->resources[ $resource ][ $action ]; |
|
284 | 284 | |
285 | 285 | // replace variables |
286 | 286 | $matchCount = preg_match_all("/:(\w*)/", $path, $variables); |
287 | 287 | if ($matchCount) { |
288 | - foreach ($variables[0] as $index => $placeholder) { |
|
289 | - if (!isset($params[$variables[1][$index]])) { |
|
290 | - throw new \InvalidArgumentException('Missing parameter: ' . $variables[1][$index]); |
|
288 | + foreach ($variables[ 0 ] as $index => $placeholder) { |
|
289 | + if (!isset($params[ $variables[ 1 ][ $index ] ])) { |
|
290 | + throw new \InvalidArgumentException('Missing parameter: '.$variables[ 1 ][ $index ]); |
|
291 | 291 | } |
292 | 292 | |
293 | - $path = str_replace($placeholder, $params[$variables[1][$index]], $path); |
|
294 | - unset($params[$variables[1][$index]]); // remove parameter from $params |
|
293 | + $path = str_replace($placeholder, $params[ $variables[ 1 ][ $index ] ], $path); |
|
294 | + unset($params[ $variables[ 1 ][ $index ] ]); // remove parameter from $params |
|
295 | 295 | } |
296 | 296 | } |
297 | 297 | |
@@ -322,16 +322,16 @@ discard block |
||
322 | 322 | curl_setopt_array($ch, $this->curlSettings); // basic settings |
323 | 323 | |
324 | 324 | // url |
325 | - $url = $this->endpoint . $path; |
|
325 | + $url = $this->endpoint.$path; |
|
326 | 326 | $url .= $method == 'get' ? $this->getAuthQueryStringWithParams($params) : $this->getAuthQueryString(); |
327 | 327 | |
328 | 328 | curl_setopt($ch, CURLOPT_URL, $url); |
329 | - curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/certs/AmazonRootCA1.pem'); |
|
329 | + curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__).'/certs/AmazonRootCA1.pem'); |
|
330 | 330 | |
331 | 331 | // http header |
332 | 332 | $requestHeaders = $this->httpHeaders; |
333 | 333 | if (!$isMultiPart) { |
334 | - $requestHeaders[] = "Content-Type: application/json"; |
|
334 | + $requestHeaders[ ] = "Content-Type: application/json"; |
|
335 | 335 | } |
336 | 336 | curl_setopt($ch, CURLOPT_HTTPHEADER, $requestHeaders); |
337 | 337 | |
@@ -344,11 +344,11 @@ discard block |
||
344 | 344 | if ($isMultiPart) { |
345 | 345 | if (version_compare(PHP_VERSION, '5.5.0') === -1) { |
346 | 346 | // fallback to old method |
347 | - $params['file'] = '@' . $params['file']; |
|
347 | + $params[ 'file' ] = '@'.$params[ 'file' ]; |
|
348 | 348 | } else { |
349 | 349 | // make use of CURLFile |
350 | 350 | curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); |
351 | - $params['file'] = new \CURLFile($params['file']); |
|
351 | + $params[ 'file' ] = new \CURLFile($params[ 'file' ]); |
|
352 | 352 | } |
353 | 353 | $postBody = $params; |
354 | 354 | } else { |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $queryString = $this->getAuthQueryString(); |
393 | 393 | |
394 | 394 | if (count($params) > 0) { |
395 | - $queryString .= '&' . http_build_query($params); |
|
395 | + $queryString .= '&'.http_build_query($params); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | return $queryString; |
@@ -406,11 +406,11 @@ discard block |
||
406 | 406 | $this->verifyTokenAndSecret(); |
407 | 407 | |
408 | 408 | $timestamp = time(); |
409 | - $devHash = md5($timestamp . $this->secret); |
|
409 | + $devHash = md5($timestamp.$this->secret); |
|
410 | 410 | |
411 | - $queryString = '?api_key=' . $this->apiKey; |
|
412 | - $queryString .= '×tamp=' . $timestamp; |
|
413 | - $queryString .= '&dev_hash=' . $devHash; |
|
411 | + $queryString = '?api_key='.$this->apiKey; |
|
412 | + $queryString .= '×tamp='.$timestamp; |
|
413 | + $queryString .= '&dev_hash='.$devHash; |
|
414 | 414 | |
415 | 415 | return $queryString; |
416 | 416 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | // change boolean value to integer for curl |
425 | 425 | foreach ($params as $key => $value) { |
426 | 426 | if (is_bool($value)) { |
427 | - $params[$key] = (int)$value; |
|
427 | + $params[ $key ] = (int) $value; |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 |