Completed
Pull Request — master (#29)
by
unknown
03:37
created
src/Onesky/Api/Tests/ProjectsApiTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Onesky/Api/Tests/TranslationsApiTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Onesky/Api/Tests/FilesApiTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Onesky/Api/Client.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
             'status' => '/projects/:project_id/translations/status',
53 53
         ),
54 54
         'import_tasks'   => array(
55
-	    'list' => '/projects/:project_id/import-tasks/',
55
+        'list' => '/projects/:project_id/import-tasks/',
56 56
             'show' => '/projects/:project_id/import-tasks/:import_id'
57 57
         ),
58 58
         'quotations'     => array(
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function getActionsByResource($resource)
151 151
     {
152
-        if (!isset($this->resources[$resource])) {
152
+        if (!isset($this->resources[ $resource ])) {
153 153
             return null; // no resource found
154 154
         }
155 155
 
156 156
         $actions = array();
157
-        foreach ($this->resources[$resource] as $action => $path) {
158
-            $actions[] = $action;
157
+        foreach ($this->resources[ $resource ] as $action => $path) {
158
+            $actions[ ] = $action;
159 159
         }
160 160
 
161 161
         return $actions;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function isMultiPartAction($resource, $action)
187 187
     {
188
-        return isset($this->multiPartActions[$resource]) && in_array($action, $this->multiPartActions[$resource]);
188
+        return isset($this->multiPartActions[ $resource ]) && in_array($action, $this->multiPartActions[ $resource ]);
189 189
     }
190 190
 
191 191
     /**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      */
197 197
     public function isExportFileAction($resource, $action)
198 198
     {
199
-        return isset($this->exportFileActions[$resource]) && in_array($action, $this->exportFileActions[$resource]);
199
+        return isset($this->exportFileActions[ $resource ]) && in_array($action, $this->exportFileActions[ $resource ]);
200 200
     }
201 201
 
202 202
     /**
@@ -262,23 +262,23 @@  discard block
 block discarded – undo
262 262
      */
263 263
     private function getRequestPath($resource, $action, &$params)
264 264
     {
265
-        if (!isset($this->resources[$resource]) || !isset($this->resources[$resource][$action])) {
265
+        if (!isset($this->resources[ $resource ]) || !isset($this->resources[ $resource ][ $action ])) {
266 266
             throw new \UnexpectedValueException('Resource path not found');
267 267
         }
268 268
 
269 269
         // get path
270
-        $path = $this->resources[$resource][$action];
270
+        $path = $this->resources[ $resource ][ $action ];
271 271
 
272 272
         // replace variables
273 273
         $matchCount = preg_match_all("/:(\w*)/", $path, $variables);
274 274
         if ($matchCount) {
275
-            foreach ($variables[0] as $index => $placeholder) {
276
-                if (!isset($params[$variables[1][$index]])) {
277
-                    throw new \InvalidArgumentException('Missing parameter: ' . $variables[1][$index]);
275
+            foreach ($variables[ 0 ] as $index => $placeholder) {
276
+                if (!isset($params[ $variables[ 1 ][ $index ] ])) {
277
+                    throw new \InvalidArgumentException('Missing parameter: ' . $variables[ 1 ][ $index ]);
278 278
                 }
279 279
 
280
-                $path = str_replace($placeholder, $params[$variables[1][$index]], $path);
281
-                unset($params[$variables[1][$index]]); // remove parameter from $params
280
+                $path = str_replace($placeholder, $params[ $variables[ 1 ][ $index ] ], $path);
281
+                unset($params[ $variables[ 1 ][ $index ] ]); // remove parameter from $params
282 282
             }
283 283
         }
284 284
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
         // http header
318 318
         $requestHeaders = $this->httpHeaders;
319 319
         if (!$isMultiPart) {
320
-            $requestHeaders[] = "Content-Type: application/json";
320
+            $requestHeaders[ ] = "Content-Type: application/json";
321 321
         }
322 322
         curl_setopt($ch, CURLOPT_HTTPHEADER, $requestHeaders);
323 323
 
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
                 if ($isMultiPart) {
331 331
                     if (version_compare(PHP_VERSION, '5.5.0') === -1) {
332 332
                         // fallback to old method
333
-                        $params['file'] = '@' . $params['file'];
333
+                        $params[ 'file' ] = '@' . $params[ 'file' ];
334 334
                     } else {
335 335
                         // make use of CURLFile
336 336
                         curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
337
-                        $params['file'] = new \CURLFile($params['file']);
337
+                        $params[ 'file' ] = new \CURLFile($params[ 'file' ]);
338 338
                     }
339 339
                     $postBody = $params;
340 340
                 } else {
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
         // change boolean value to integer for curl
411 411
         foreach ($params as $key => $value) {
412 412
             if (is_bool($value)) {
413
-                $params[$key] = (int)$value;
413
+                $params[ $key ] = (int) $value;
414 414
             }
415 415
         }
416 416
 
Please login to merge, or discard this patch.