@@ -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 | } |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function getActionsByResource($resource) |
| 152 | 152 | { |
| 153 | - if (!isset($this->resources[$resource])) { |
|
| 153 | + if (!isset($this->resources[ $resource ])) { |
|
| 154 | 154 | return null; // no resource found |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $actions = array(); |
| 158 | - foreach ($this->resources[$resource] as $action => $path) { |
|
| 159 | - $actions[] = $action; |
|
| 158 | + foreach ($this->resources[ $resource ] as $action => $path) { |
|
| 159 | + $actions[ ] = $action; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | return $actions; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function isMultiPartAction($resource, $action) |
| 188 | 188 | { |
| 189 | - return isset($this->multiPartActions[$resource]) && in_array($action, $this->multiPartActions[$resource]); |
|
| 189 | + return isset($this->multiPartActions[ $resource ]) && in_array($action, $this->multiPartActions[ $resource ]); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | public function isExportFileAction($resource, $action) |
| 199 | 199 | { |
| 200 | - return isset($this->exportFileActions[$resource]) && in_array($action, $this->exportFileActions[$resource]); |
|
| 200 | + return isset($this->exportFileActions[ $resource ]) && in_array($action, $this->exportFileActions[ $resource ]); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -263,23 +263,23 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | private function getRequestPath($resource, $action, &$params) |
| 265 | 265 | { |
| 266 | - if (!isset($this->resources[$resource]) || !isset($this->resources[$resource][$action])) { |
|
| 266 | + if (!isset($this->resources[ $resource ]) || !isset($this->resources[ $resource ][ $action ])) { |
|
| 267 | 267 | throw new \UnexpectedValueException('Resource path not found'); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | // get path |
| 271 | - $path = $this->resources[$resource][$action]; |
|
| 271 | + $path = $this->resources[ $resource ][ $action ]; |
|
| 272 | 272 | |
| 273 | 273 | // replace variables |
| 274 | 274 | $matchCount = preg_match_all("/:(\w*)/", $path, $variables); |
| 275 | 275 | if ($matchCount) { |
| 276 | - foreach ($variables[0] as $index => $placeholder) { |
|
| 277 | - if (!isset($params[$variables[1][$index]])) { |
|
| 278 | - throw new \InvalidArgumentException('Missing parameter: ' . $variables[1][$index]); |
|
| 276 | + foreach ($variables[ 0 ] as $index => $placeholder) { |
|
| 277 | + if (!isset($params[ $variables[ 1 ][ $index ] ])) { |
|
| 278 | + throw new \InvalidArgumentException('Missing parameter: '.$variables[ 1 ][ $index ]); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - $path = str_replace($placeholder, $params[$variables[1][$index]], $path); |
|
| 282 | - unset($params[$variables[1][$index]]); // remove parameter from $params |
|
| 281 | + $path = str_replace($placeholder, $params[ $variables[ 1 ][ $index ] ], $path); |
|
| 282 | + unset($params[ $variables[ 1 ][ $index ] ]); // remove parameter from $params |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
@@ -310,16 +310,16 @@ discard block |
||
| 310 | 310 | curl_setopt_array($ch, $this->curlSettings); // basic settings |
| 311 | 311 | |
| 312 | 312 | // url |
| 313 | - $url = $this->endpoint . $path; |
|
| 313 | + $url = $this->endpoint.$path; |
|
| 314 | 314 | $url .= $method == 'get' ? $this->getAuthQueryStringWithParams($params) : $this->getAuthQueryString(); |
| 315 | 315 | |
| 316 | 316 | curl_setopt($ch, CURLOPT_URL, $url); |
| 317 | - curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cert/StarfieldServicesRootCertificateAuthority-G2.pem'); |
|
| 317 | + curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__).'/cert/StarfieldServicesRootCertificateAuthority-G2.pem'); |
|
| 318 | 318 | |
| 319 | 319 | // http header |
| 320 | 320 | $requestHeaders = $this->httpHeaders; |
| 321 | 321 | if (!$isMultiPart) { |
| 322 | - $requestHeaders[] = "Content-Type: application/json"; |
|
| 322 | + $requestHeaders[ ] = "Content-Type: application/json"; |
|
| 323 | 323 | } |
| 324 | 324 | curl_setopt($ch, CURLOPT_HTTPHEADER, $requestHeaders); |
| 325 | 325 | |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | if ($isMultiPart) { |
| 333 | 333 | if (version_compare(PHP_VERSION, '5.5.0') === -1) { |
| 334 | 334 | // fallback to old method |
| 335 | - $params['file'] = '@' . $params['file']; |
|
| 335 | + $params[ 'file' ] = '@'.$params[ 'file' ]; |
|
| 336 | 336 | } else { |
| 337 | 337 | // make use of CURLFile |
| 338 | 338 | curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); |
| 339 | - $params['file'] = new \CURLFile($params['file']); |
|
| 339 | + $params[ 'file' ] = new \CURLFile($params[ 'file' ]); |
|
| 340 | 340 | } |
| 341 | 341 | $postBody = $params; |
| 342 | 342 | } else { |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | $queryString = $this->getAuthQueryString(); |
| 381 | 381 | |
| 382 | 382 | if (count($params) > 0) { |
| 383 | - $queryString .= '&' . http_build_query($params); |
|
| 383 | + $queryString .= '&'.http_build_query($params); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | return $queryString; |
@@ -394,11 +394,11 @@ discard block |
||
| 394 | 394 | $this->verifyTokenAndSecret(); |
| 395 | 395 | |
| 396 | 396 | $timestamp = time(); |
| 397 | - $devHash = md5($timestamp . $this->secret); |
|
| 397 | + $devHash = md5($timestamp.$this->secret); |
|
| 398 | 398 | |
| 399 | - $queryString = '?api_key=' . $this->apiKey; |
|
| 400 | - $queryString .= '×tamp=' . $timestamp; |
|
| 401 | - $queryString .= '&dev_hash=' . $devHash; |
|
| 399 | + $queryString = '?api_key='.$this->apiKey; |
|
| 400 | + $queryString .= '×tamp='.$timestamp; |
|
| 401 | + $queryString .= '&dev_hash='.$devHash; |
|
| 402 | 402 | |
| 403 | 403 | return $queryString; |
| 404 | 404 | } |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | // change boolean value to integer for curl |
| 413 | 413 | foreach ($params as $key => $value) { |
| 414 | 414 | if (is_bool($value)) { |
| 415 | - $params[$key] = (int)$value; |
|
| 415 | + $params[ $key ] = (int) $value; |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | |