@@ -1,20 +1,20 @@ |
||
| 1 | 1 | <?php namespace Neomerx\JsonApi\Contracts\Encoder; |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * Copyright 2015 [email protected] (www.neomerx.com) |
|
| 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 [email protected] (www.neomerx.com) |
|
| 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 |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | if ($this->selfSubUrl === null) { |
| 88 | - $this->selfSubUrl = '/' . $this->getResourceType(); |
|
| 88 | + $this->selfSubUrl = '/'.$this->getResourceType(); |
|
| 89 | 89 | } else { |
| 90 | 90 | $isOk = |
| 91 | 91 | is_string($this->selfSubUrl) === true && |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function getSelfSubUrl($resource = null) |
| 118 | 118 | { |
| 119 | - return $resource === null ? $this->selfSubUrl : $this->selfSubUrl . '/' . $this->getId($resource); |
|
| 119 | + return $resource === null ? $this->selfSubUrl : $this->selfSubUrl.'/'.$this->getId($resource); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | protected function getRelationshipSelfUrl($resource, $name) |
| 267 | 267 | { |
| 268 | - $url = $this->getSelfSubUrl($resource) . '/' . DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $name; |
|
| 268 | + $url = $this->getSelfSubUrl($resource).'/'.DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$name; |
|
| 269 | 269 | |
| 270 | 270 | return $url; |
| 271 | 271 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | protected function getRelationshipRelatedUrl($resource, $name) |
| 280 | 280 | { |
| 281 | - $url = $this->getSelfSubUrl($resource) . '/' . $name; |
|
| 281 | + $url = $this->getSelfSubUrl($resource).'/'.$name; |
|
| 282 | 282 | |
| 283 | 283 | return $url; |
| 284 | 284 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function add(ErrorInterface $error) |
| 119 | 119 | { |
| 120 | - $this->items[] =$error; |
|
| 120 | + $this->items[] = $error; |
|
| 121 | 121 | |
| 122 | 122 | return $this; |
| 123 | 123 | } |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | protected function getPathToData() |
| 397 | 397 | { |
| 398 | - return '/' . DocumentInterface::KEYWORD_DATA; |
|
| 398 | + return '/'.DocumentInterface::KEYWORD_DATA; |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | /** |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | protected function getPathToType() |
| 405 | 405 | { |
| 406 | - return $this->getPathToData() . '/' . DocumentInterface::KEYWORD_TYPE; |
|
| 406 | + return $this->getPathToData().'/'.DocumentInterface::KEYWORD_TYPE; |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /** |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | */ |
| 412 | 412 | protected function getPathToId() |
| 413 | 413 | { |
| 414 | - return $this->getPathToData() . '/' . DocumentInterface::KEYWORD_ID; |
|
| 414 | + return $this->getPathToData().'/'.DocumentInterface::KEYWORD_ID; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | /** |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | protected function getPathToAttribute($name) |
| 423 | 423 | { |
| 424 | - return $this->getPathToData() . '/' . DocumentInterface::KEYWORD_ATTRIBUTES . '/' . $name; |
|
| 424 | + return $this->getPathToData().'/'.DocumentInterface::KEYWORD_ATTRIBUTES.'/'.$name; |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | /** |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | protected function getPathToRelationships() |
| 431 | 431 | { |
| 432 | - return $this->getPathToData() . '/' . DocumentInterface::KEYWORD_RELATIONSHIPS; |
|
| 432 | + return $this->getPathToData().'/'.DocumentInterface::KEYWORD_RELATIONSHIPS; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | */ |
| 440 | 440 | protected function getPathToRelationship($name) |
| 441 | 441 | { |
| 442 | - return $this->getPathToRelationships() . '/' . $name; |
|
| 442 | + return $this->getPathToRelationships().'/'.$name; |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | /** |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | protected function getPathToRelationshipType($name) |
| 451 | 451 | { |
| 452 | - return $this->getPathToRelationship($name) . '/' . |
|
| 453 | - DocumentInterface::KEYWORD_DATA . '/' . DocumentInterface::KEYWORD_TYPE; |
|
| 452 | + return $this->getPathToRelationship($name).'/'. |
|
| 453 | + DocumentInterface::KEYWORD_DATA.'/'.DocumentInterface::KEYWORD_TYPE; |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | /** |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | */ |
| 461 | 461 | protected function getPathToRelationshipId($name) |
| 462 | 462 | { |
| 463 | - return $this->getPathToRelationship($name) . '/' . |
|
| 464 | - DocumentInterface::KEYWORD_DATA . '/' . DocumentInterface::KEYWORD_ID; |
|
| 463 | + return $this->getPathToRelationship($name).'/'. |
|
| 464 | + DocumentInterface::KEYWORD_DATA.'/'.DocumentInterface::KEYWORD_ID; |
|
| 465 | 465 | } |
| 466 | 466 | } |
@@ -41,9 +41,9 @@ |
||
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * @param $sortField |
|
| 45 | - * @param $isAscending |
|
| 46 | - * @param null $sortRelationAttribute |
|
| 44 | + * @param string $sortField |
|
| 45 | + * @param boolean $isAscending |
|
| 46 | + * @param null $sortRelationshipAttribute |
|
| 47 | 47 | */ |
| 48 | 48 | public function __construct($sortField, $isAscending, $sortRelationshipAttribute=null) |
| 49 | 49 | { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param $isAscending |
| 46 | 46 | * @param null $sortRelationAttribute |
| 47 | 47 | */ |
| 48 | - public function __construct($sortField, $isAscending, $sortRelationshipAttribute=null) |
|
| 48 | + public function __construct($sortField, $isAscending, $sortRelationshipAttribute = null) |
|
| 49 | 49 | { |
| 50 | 50 | is_string($sortField) === true ?: Exceptions::throwInvalidArgument('sortField', $sortField); |
| 51 | 51 | is_string($sortRelationshipAttribute) === true || is_null($sortRelationshipAttribute) === true ?: Exceptions::throwInvalidArgument('sortRelationshipAttribute', $sortRelationshipAttribute); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $prefix = $this->isAscending() ? '' : '-'; |
| 65 | 65 | |
| 66 | - return $prefix . $this->getField(); |
|
| 66 | + return $prefix.$this->getField(); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |