Completed
Branch master (221664)
by
unknown
02:01
created
src/Contracts/Encoder/Parameters/EncodingParametersInterface.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@
 block discarded – undo
1 1
 <?php namespace Neomerx\JsonApi\Contracts\Encoder\Parameters;
2 2
 
3 3
     /**
4
- * Copyright 2015-2017 [email protected]
5
- *
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
4
+     * Copyright 2015-2017 [email protected]
5
+     *
6
+     * Licensed under the Apache License, Version 2.0 (the "License");
7
+     * you may not use this file except in compliance with the License.
8
+     * You may obtain a copy of the License at
9
+     *
10
+     * http://www.apache.org/licenses/LICENSE-2.0
11
+     *
12
+     * Unless required by applicable law or agreed to in writing, software
13
+     * distributed under the License is distributed on an "AS IS" BASIS,
14
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+     * See the License for the specific language governing permissions and
16
+     * limitations under the License.
17
+     */
18 18
 
19 19
 /**
20 20
  * @package Neomerx\JsonApi
Please login to merge, or discard this patch.
src/Document/Document.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         $foundInData     = isset($this->bufferForData[$type][$idx]);
269 269
         $foundInIncluded = isset($this->bufferForIncluded[$type][$idx]);
270 270
 
271
-        $addMeta = function (array $representation, Closure $getMetaClosure) {
271
+        $addMeta = function(array $representation, Closure $getMetaClosure) {
272 272
             if (empty($representation[self::KEYWORD_RELATIONSHIPS]) === true) {
273 273
                 // if no relationships have been added remove empty placeholder
274 274
                 unset($representation[self::KEYWORD_RELATIONSHIPS]);
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             $representation = $this->bufferForData[$type][$idx];
288 288
             unset($this->bufferForData[$type][$idx]);
289 289
 
290
-            $this->data[] = $addMeta($representation, function () use ($resource) {
290
+            $this->data[] = $addMeta($representation, function() use ($resource) {
291 291
                 return $resource->getRelationshipsPrimaryMeta();
292 292
             });
293 293
         }
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             $representation = $this->bufferForIncluded[$type][$idx];
297 297
             unset($this->bufferForIncluded[$type][$idx]);
298 298
 
299
-            $this->included[] = $addMeta($representation, function () use ($resource) {
299
+            $this->included[] = $addMeta($representation, function() use ($resource) {
300 300
                 return $resource->getRelationshipsInclusionMeta();
301 301
             });
302 302
             // remember we added (type, id) at index
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                 self::KEYWORD_JSON_API => $this->version,
316 316
                 self::KEYWORD_META     => $this->meta,
317 317
                 self::KEYWORD_ERRORS   => $this->errors,
318
-            ], function ($value) {
318
+            ], function($value) {
319 319
                 return $value !== null;
320 320
             });
321 321
         }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
             self::KEYWORD_LINKS    => $this->links,
327 327
             self::KEYWORD_DATA     => true, // this field wont be filtered
328 328
             self::KEYWORD_INCLUDED => empty($this->included) === true ? null : array_values($this->included),
329
-        ], function ($value) {
329
+        ], function($value) {
330 330
             return $value !== null;
331 331
         });
332 332
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
             self::KEYWORD_ERRORS_DETAIL => $error->getDetail(),
375 375
             self::KEYWORD_ERRORS_SOURCE => $error->getSource(),
376 376
             self::KEYWORD_ERRORS_META   => $error->getMeta(),
377
-        ], function ($value) {
377
+        ], function($value) {
378 378
             return $value !== null;
379 379
         });
380 380
 
Please login to merge, or discard this patch.
src/Exceptions/ErrorCollection.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function add(ErrorInterface $error)
121 121
     {
122
-        $this->items[] =$error;
122
+        $this->items[] = $error;
123 123
 
124 124
         return $this;
125 125
     }
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
      */
423 423
     protected function getPathToData()
424 424
     {
425
-        return '/' . DocumentInterface::KEYWORD_DATA;
425
+        return '/'.DocumentInterface::KEYWORD_DATA;
426 426
     }
427 427
 
428 428
     /**
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
      */
431 431
     protected function getPathToType()
432 432
     {
433
-        return $this->getPathToData() . '/' . DocumentInterface::KEYWORD_TYPE;
433
+        return $this->getPathToData().'/'.DocumentInterface::KEYWORD_TYPE;
434 434
     }
435 435
 
436 436
     /**
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
      */
439 439
     protected function getPathToId()
440 440
     {
441
-        return $this->getPathToData() . '/' . DocumentInterface::KEYWORD_ID;
441
+        return $this->getPathToData().'/'.DocumentInterface::KEYWORD_ID;
442 442
     }
443 443
 
444 444
     /**
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
      */
447 447
     protected function getPathToAttributes()
448 448
     {
449
-        return $this->getPathToData() . '/' . DocumentInterface::KEYWORD_ATTRIBUTES;
449
+        return $this->getPathToData().'/'.DocumentInterface::KEYWORD_ATTRIBUTES;
450 450
     }
451 451
 
452 452
     /**
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
      */
457 457
     protected function getPathToAttribute($name)
458 458
     {
459
-        return $this->getPathToData() . '/' . DocumentInterface::KEYWORD_ATTRIBUTES . '/' . $name;
459
+        return $this->getPathToData().'/'.DocumentInterface::KEYWORD_ATTRIBUTES.'/'.$name;
460 460
     }
461 461
 
462 462
     /**
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
      */
465 465
     protected function getPathToRelationships()
466 466
     {
467
-        return $this->getPathToData() . '/' . DocumentInterface::KEYWORD_RELATIONSHIPS;
467
+        return $this->getPathToData().'/'.DocumentInterface::KEYWORD_RELATIONSHIPS;
468 468
     }
469 469
 
470 470
     /**
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
      */
475 475
     protected function getPathToRelationship($name)
476 476
     {
477
-        return $this->getPathToRelationships() . '/' . $name;
477
+        return $this->getPathToRelationships().'/'.$name;
478 478
     }
479 479
 
480 480
     /**
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
      */
485 485
     protected function getPathToRelationshipType($name)
486 486
     {
487
-        return $this->getPathToRelationship($name) . '/' .
488
-            DocumentInterface::KEYWORD_DATA . '/' . DocumentInterface::KEYWORD_TYPE;
487
+        return $this->getPathToRelationship($name).'/'.
488
+            DocumentInterface::KEYWORD_DATA.'/'.DocumentInterface::KEYWORD_TYPE;
489 489
     }
490 490
 
491 491
     /**
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
      */
496 496
     protected function getPathToRelationshipId($name)
497 497
     {
498
-        return $this->getPathToRelationship($name) . '/' .
499
-            DocumentInterface::KEYWORD_DATA . '/' . DocumentInterface::KEYWORD_ID;
498
+        return $this->getPathToRelationship($name).'/'.
499
+            DocumentInterface::KEYWORD_DATA.'/'.DocumentInterface::KEYWORD_ID;
500 500
     }
501 501
 }
Please login to merge, or discard this patch.
src/Http/Headers/HeaderParametersParser.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                 $header            = $this->getHeader($request, HeaderInterface::HEADER_CONTENT_TYPE);
65 65
                 $contentTypeHeader = Header::parse($header, HeaderInterface::HEADER_CONTENT_TYPE);
66 66
             } catch (InvalidArgumentException $exception) {
67
-                $title  = T::t('Invalid ' . HeaderInterface::HEADER_CONTENT_TYPE . ' header.');
67
+                $title  = T::t('Invalid '.HeaderInterface::HEADER_CONTENT_TYPE.' header.');
68 68
                 $error  = new Error(null, null, null, null, $title);
69 69
                 E::throwException(new E([$error], E::HTTP_CODE_BAD_REQUEST, $exception));
70 70
             }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             $header       = $this->getHeader($request, HeaderInterface::HEADER_ACCEPT);
75 75
             $acceptHeader = AcceptHeader::parse($header);
76 76
         } catch (InvalidArgumentException $exception) {
77
-            $title  = T::t('Invalid ' . HeaderInterface::HEADER_ACCEPT . ' header.');
77
+            $title  = T::t('Invalid '.HeaderInterface::HEADER_ACCEPT.' header.');
78 78
             $error  = new Error(null, null, null, null, $title);
79 79
             E::throwException(new E([$error], E::HTTP_CODE_BAD_REQUEST, $exception));
80 80
         }
@@ -82,8 +82,7 @@  discard block
 block discarded – undo
82 82
         $method = $request->getMethod();
83 83
 
84 84
         return $checkContentType === true ?
85
-            $this->factory->createHeaderParameters($method, $acceptHeader, $contentTypeHeader):
86
-            $this->factory->createNoContentHeaderParameters($method, $acceptHeader);
85
+            $this->factory->createHeaderParameters($method, $acceptHeader, $contentTypeHeader) : $this->factory->createNoContentHeaderParameters($method, $acceptHeader);
87 86
     }
88 87
 
89 88
     /**
Please login to merge, or discard this patch.
src/Http/Query/QueryParametersParser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             foreach ($fieldSets as $type => $fields) {
93 93
                 // We expect fields to be comma separated or empty strings. Multi-dimension arrays are not allowed.
94 94
                 if (is_string($fields) === false) {
95
-                    $detail = T::t(self::PARAM_FIELDS . ' parameter values should be comma separated strings.');
95
+                    $detail = T::t(self::PARAM_FIELDS.' parameter values should be comma separated strings.');
96 96
                     throw new E($this->createInvalidQueryErrors($detail), E::HTTP_CODE_BAD_REQUEST);
97 97
                 }
98 98
                 $result[$type] = (empty($fields) === true ? [] : explode(',', $fields));
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
         if ($sortParam !== null) {
119 119
             foreach (explode(',', $sortParam) as $param) {
120 120
                 if (empty($param) === true) {
121
-                    $detail = T::t('Parameter ' . self::PARAM_SORT . ' should have valid value specified.');
121
+                    $detail = T::t('Parameter '.self::PARAM_SORT.' should have valid value specified.');
122 122
                     throw new E($this->createInvalidQueryErrors($detail), E::HTTP_CODE_BAD_REQUEST);
123 123
                 }
124 124
                 $isDesc = $isDesc = ($param[0] === '-');
125 125
                 $sortField = ltrim($param, '+-');
126 126
                 if (empty($sortField) === true) {
127
-                    $detail = T::t('Parameter ' . self::PARAM_SORT . ' should have valid name specified.');
127
+                    $detail = T::t('Parameter '.self::PARAM_SORT.' should have valid name specified.');
128 128
                     throw new E($this->createInvalidQueryErrors($detail), E::HTTP_CODE_BAD_REQUEST);
129 129
                 }
130 130
                 $sortParams[] = $this->factory->createSortParam($sortField, $isDesc === false);
Please login to merge, or discard this patch.
src/Http/Responses.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     {
175 175
         $resSubUrl = $this->getSchemaContainer()->getSchema($resource)->getSelfSubLink($resource)->getSubHref();
176 176
         $urlPrefix = $this->getUrlPrefix();
177
-        $location  = $urlPrefix . $resSubUrl;
177
+        $location  = $urlPrefix.$resSubUrl;
178 178
 
179 179
         return $location;
180 180
     }
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
             if (isset($params[MediaTypeInterface::PARAM_EXT])) {
201 201
                 $ext = $params[MediaTypeInterface::PARAM_EXT];
202 202
                 if (empty($ext) === false) {
203
-                    $contentType .= $separator . MediaTypeInterface::PARAM_EXT . '="' . $ext . '"';
204
-                    $separator   = ',';
203
+                    $contentType .= $separator.MediaTypeInterface::PARAM_EXT.'="'.$ext.'"';
204
+                    $separator = ',';
205 205
                 }
206 206
             }
207 207
 
208 208
             $extensions = $this->getSupportedExtensions();
209 209
             if ($extensions !== null && ($list = $extensions->getExtensions()) !== null && empty($list) === false) {
210
-                $contentType .= $separator . MediaTypeInterface::PARAM_SUPPORTED_EXT . '="' . $list . '"';
210
+                $contentType .= $separator.MediaTypeInterface::PARAM_SUPPORTED_EXT.'="'.$list.'"';
211 211
             }
212 212
 
213 213
             $headers[self::HEADER_CONTENT_TYPE] = $contentType;
Please login to merge, or discard this patch.