@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function testProjectsListDetectInvalidAuthentication() |
| 48 | 48 | { |
| 49 | - $this->api->projects('list', ['project_group_id' => 123]); |
|
| 49 | + $this->api->projects('list', [ 'project_group_id' => 123 ]); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function testProjectsShowDetectInvalidAuthentication() |
| 67 | 67 | { |
| 68 | - $this->api->projects('show', ['project_id' => 123]); |
|
| 68 | + $this->api->projects('show', [ 'project_id' => 123 ]); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function testProjectsCreateDetectMissingParam() |
| 85 | 85 | { |
| 86 | - $this->api->projects('create', ['project_group_id' => 123]); |
|
| 86 | + $this->api->projects('create', [ 'project_group_id' => 123 ]); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function testProjectsUpdateDetectInvalidAuthentication() |
| 103 | 103 | { |
| 104 | - $this->api->projects('update', ['project_id' => 123]); |
|
| 104 | + $this->api->projects('update', [ 'project_id' => 123 ]); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function testProjectsDeleteDetectInvalidAuthentication() |
| 121 | 121 | { |
| 122 | - $this->api->projects('delete', ['project_id' => 123]); |
|
| 122 | + $this->api->projects('delete', [ 'project_id' => 123 ]); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -137,6 +137,6 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function testProjectsLanguagesDetectInvalidAuthentication() |
| 139 | 139 | { |
| 140 | - $this->api->projects('languages', ['project_id' => 123]); |
|
| 140 | + $this->api->projects('languages', [ 'project_id' => 123 ]); |
|
| 141 | 141 | } |
| 142 | 142 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function testTranslationsExportDetectInvalidAuthentication() |
| 48 | 48 | { |
| 49 | - $this->api->translations('export', ['project_id' => 123]); |
|
| 49 | + $this->api->translations('export', [ 'project_id' => 123 ]); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function testTranslationsStatusDetectInvalidAuthentication() |
| 67 | 67 | { |
| 68 | - $this->api->translations('status', ['project_id' => 123]); |
|
| 68 | + $this->api->translations('status', [ 'project_id' => 123 ]); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function testFilesListDetectInvalidAuthentication() |
| 48 | 48 | { |
| 49 | - $this->api->files('list', ['project_id' => 123]); |
|
| 49 | + $this->api->files('list', [ 'project_id' => 123 ]); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function testFilesUploadDetectInvalidAuthentication() |
| 67 | 67 | { |
| 68 | - $this->api->files('upload', ['project_id' => 123]); |
|
| 68 | + $this->api->files('upload', [ 'project_id' => 123 ]); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -83,6 +83,6 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function testFilesDeleteDetectInvalidAuthentication() |
| 85 | 85 | { |
| 86 | - $this->api->files('delete', ['project_id' => 123]); |
|
| 86 | + $this->api->files('delete', [ 'project_id' => 123 ]); |
|
| 87 | 87 | } |
| 88 | 88 | } |
@@ -161,13 +161,13 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function getActionsByResource($resource) |
| 163 | 163 | { |
| 164 | - if (!isset($this->resources[$resource])) { |
|
| 164 | + if (!isset($this->resources[ $resource ])) { |
|
| 165 | 165 | return null; // no resource found |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $actions = array(); |
| 169 | - foreach ($this->resources[$resource] as $action => $path) { |
|
| 170 | - $actions[] = $action; |
|
| 169 | + foreach ($this->resources[ $resource ] as $action => $path) { |
|
| 170 | + $actions[ ] = $action; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | return $actions; |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | public function isMultiPartAction($resource, $action) |
| 199 | 199 | { |
| 200 | - return isset($this->multiPartActions[$resource]) && in_array($action, $this->multiPartActions[$resource]); |
|
| 200 | + return isset($this->multiPartActions[ $resource ]) && in_array($action, $this->multiPartActions[ $resource ]); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public function isExportFileAction($resource, $action) |
| 210 | 210 | { |
| 211 | - return isset($this->exportFileActions[$resource]) && in_array($action, $this->exportFileActions[$resource]); |
|
| 211 | + return isset($this->exportFileActions[ $resource ]) && in_array($action, $this->exportFileActions[ $resource ]); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -274,23 +274,23 @@ discard block |
||
| 274 | 274 | */ |
| 275 | 275 | private function getRequestPath($resource, $action, &$params) |
| 276 | 276 | { |
| 277 | - if (!isset($this->resources[$resource]) || !isset($this->resources[$resource][$action])) { |
|
| 277 | + if (!isset($this->resources[ $resource ]) || !isset($this->resources[ $resource ][ $action ])) { |
|
| 278 | 278 | throw new \UnexpectedValueException('Resource path not found'); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // get path |
| 282 | - $path = $this->resources[$resource][$action]; |
|
| 282 | + $path = $this->resources[ $resource ][ $action ]; |
|
| 283 | 283 | |
| 284 | 284 | // replace variables |
| 285 | 285 | $matchCount = preg_match_all("/:(\w*)/", $path, $variables); |
| 286 | 286 | if ($matchCount) { |
| 287 | - foreach ($variables[0] as $index => $placeholder) { |
|
| 288 | - if (!isset($params[$variables[1][$index]])) { |
|
| 289 | - throw new \InvalidArgumentException('Missing parameter: ' . $variables[1][$index]); |
|
| 287 | + foreach ($variables[ 0 ] as $index => $placeholder) { |
|
| 288 | + if (!isset($params[ $variables[ 1 ][ $index ] ])) { |
|
| 289 | + throw new \InvalidArgumentException('Missing parameter: '.$variables[ 1 ][ $index ]); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - $path = str_replace($placeholder, $params[$variables[1][$index]], $path); |
|
| 293 | - unset($params[$variables[1][$index]]); // remove parameter from $params |
|
| 292 | + $path = str_replace($placeholder, $params[ $variables[ 1 ][ $index ] ], $path); |
|
| 293 | + unset($params[ $variables[ 1 ][ $index ] ]); // remove parameter from $params |
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | curl_setopt_array($ch, $this->curlSettings); // basic settings |
| 322 | 322 | |
| 323 | 323 | // url |
| 324 | - $url = $this->endpoint . $path; |
|
| 324 | + $url = $this->endpoint.$path; |
|
| 325 | 325 | $url .= $method == 'get' ? $this->getAuthQueryStringWithParams($params) : $this->getAuthQueryString(); |
| 326 | 326 | |
| 327 | 327 | curl_setopt($ch, CURLOPT_URL, $url); |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | // http header |
| 330 | 330 | $requestHeaders = $this->httpHeaders; |
| 331 | 331 | if (!$isMultiPart) { |
| 332 | - $requestHeaders[] = "Content-Type: application/json"; |
|
| 332 | + $requestHeaders[ ] = "Content-Type: application/json"; |
|
| 333 | 333 | } |
| 334 | 334 | curl_setopt($ch, CURLOPT_HTTPHEADER, $requestHeaders); |
| 335 | 335 | |
@@ -342,11 +342,11 @@ discard block |
||
| 342 | 342 | if ($isMultiPart) { |
| 343 | 343 | if (version_compare(PHP_VERSION, '5.5.0') === -1) { |
| 344 | 344 | // fallback to old method |
| 345 | - $params['file'] = '@' . $params['file']; |
|
| 345 | + $params[ 'file' ] = '@'.$params[ 'file' ]; |
|
| 346 | 346 | } else { |
| 347 | 347 | // make use of CURLFile |
| 348 | 348 | curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); |
| 349 | - $params['file'] = new \CURLFile($params['file']); |
|
| 349 | + $params[ 'file' ] = new \CURLFile($params[ 'file' ]); |
|
| 350 | 350 | } |
| 351 | 351 | $postBody = $params; |
| 352 | 352 | } else { |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | $queryString = $this->getAuthQueryString(); |
| 391 | 391 | |
| 392 | 392 | if (count($params) > 0) { |
| 393 | - $queryString .= '&' . http_build_query($params); |
|
| 393 | + $queryString .= '&'.http_build_query($params); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | return $queryString; |
@@ -404,11 +404,11 @@ discard block |
||
| 404 | 404 | $this->verifyTokenAndSecret(); |
| 405 | 405 | |
| 406 | 406 | $timestamp = time(); |
| 407 | - $devHash = md5($timestamp . $this->secret); |
|
| 407 | + $devHash = md5($timestamp.$this->secret); |
|
| 408 | 408 | |
| 409 | - $queryString = '?api_key=' . $this->apiKey; |
|
| 410 | - $queryString .= '×tamp=' . $timestamp; |
|
| 411 | - $queryString .= '&dev_hash=' . $devHash; |
|
| 409 | + $queryString = '?api_key='.$this->apiKey; |
|
| 410 | + $queryString .= '×tamp='.$timestamp; |
|
| 411 | + $queryString .= '&dev_hash='.$devHash; |
|
| 412 | 412 | |
| 413 | 413 | return $queryString; |
| 414 | 414 | } |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | // change boolean value to integer for curl |
| 423 | 423 | foreach ($params as $key => $value) { |
| 424 | 424 | if (is_bool($value)) { |
| 425 | - $params[$key] = (int)$value; |
|
| 425 | + $params[ $key ] = (int) $value; |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | |