@@ -87,7 +87,7 @@ |
||
87 | 87 | */ |
88 | 88 | public static function getCompare(): Closure |
89 | 89 | { |
90 | - return function (AcceptMediaTypeInterface $lhs, AcceptMediaTypeInterface $rhs) { |
|
90 | + return function(AcceptMediaTypeInterface $lhs, AcceptMediaTypeInterface $rhs) { |
|
91 | 91 | $qualityCompare = self::compareQuality($lhs->getQuality(), $rhs->getQuality()); |
92 | 92 | if ($qualityCompare !== 0) { |
93 | 93 | return $qualityCompare; |
@@ -97,7 +97,7 @@ |
||
97 | 97 | public function getMediaType(): string |
98 | 98 | { |
99 | 99 | if ($this->mediaType === null) { |
100 | - $this->mediaType = $this->getType() . '/' . $this->getSubType(); |
|
100 | + $this->mediaType = $this->getType().'/'.$this->getSubType(); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | return $this->mediaType; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function withIncludedPaths(iterable $paths): EncoderInterface |
182 | 182 | { |
183 | - assert(call_user_func(function (array $paths): bool |
|
183 | + assert(call_user_func(function(array $paths): bool |
|
184 | 184 | { |
185 | 185 | $pathsOk = true; |
186 | 186 | foreach ($paths as $path) { |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | */ |
500 | 500 | protected function encodeDataToArray($data): array |
501 | 501 | { |
502 | - if(is_array($data) === false && is_object($data) === false && $data !== null) { |
|
502 | + if (is_array($data) === false && is_object($data) === false && $data !== null) { |
|
503 | 503 | throw new InvalidArgumentException(); |
504 | 504 | } |
505 | 505 |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function add(ErrorInterface $error): self |
121 | 121 | { |
122 | - $this->items[] =$error; |
|
122 | + $this->items[] = $error; |
|
123 | 123 | |
124 | 124 | return $this; |
125 | 125 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | */ |
423 | 423 | protected function getPathToData(): string |
424 | 424 | { |
425 | - return '/' . DocumentInterface::KEYWORD_DATA; |
|
425 | + return '/'.DocumentInterface::KEYWORD_DATA; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | */ |
431 | 431 | protected function getPathToType(): string |
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 |
||
438 | 438 | */ |
439 | 439 | protected function getPathToId(): string |
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 |
||
446 | 446 | */ |
447 | 447 | protected function getPathToAttributes(): string |
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 |
||
456 | 456 | */ |
457 | 457 | protected function getPathToAttribute(string $name): string |
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 |
||
464 | 464 | */ |
465 | 465 | protected function getPathToRelationships(): string |
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 |
||
474 | 474 | */ |
475 | 475 | protected function getPathToRelationship(string $name): string |
476 | 476 | { |
477 | - return $this->getPathToRelationships() . '/' . $name; |
|
477 | + return $this->getPathToRelationships().'/'.$name; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | */ |
485 | 485 | protected function getPathToRelationshipType(string $name): string |
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 |
||
495 | 495 | */ |
496 | 496 | protected function getPathToRelationshipId(string $name): string |
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 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | { |
76 | 76 | // Feel free to override this method to change default URL or add meta |
77 | 77 | |
78 | - $url = $this->getSelfSubUrl($resource) . '/' . DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $name; |
|
78 | + $url = $this->getSelfSubUrl($resource).'/'.DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$name; |
|
79 | 79 | |
80 | 80 | return $this->getFactory()->createLink(true, $url, false); |
81 | 81 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | { |
88 | 88 | // Feel free to override this method to change default URL or add meta |
89 | 89 | |
90 | - $url = $this->getSelfSubUrl($resource) . '/' . $name; |
|
90 | + $url = $this->getSelfSubUrl($resource).'/'.$name; |
|
91 | 91 | |
92 | 92 | return $this->getFactory()->createLink(true, $url, false); |
93 | 93 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | protected function getResourcesSubUrl(): string |
155 | 155 | { |
156 | 156 | if ($this->subUrl === null) { |
157 | - $this->subUrl = '/' . $this->getType(); |
|
157 | + $this->subUrl = '/'.$this->getType(); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return $this->subUrl; |
@@ -167,6 +167,6 @@ discard block |
||
167 | 167 | */ |
168 | 168 | protected function getSelfSubUrl($resource): string |
169 | 169 | { |
170 | - return $this->getResourcesSubUrl() . '/' . $this->getId($resource); |
|
170 | + return $this->getResourcesSubUrl().'/'.$this->getId($resource); |
|
171 | 171 | } |
172 | 172 | } |
@@ -138,6 +138,6 @@ |
||
138 | 138 | */ |
139 | 139 | protected function buildUrl(string $prefix): string |
140 | 140 | { |
141 | - return $this->isSubUrl() ? $prefix . $this->getValue() : $this->getValue(); |
|
141 | + return $this->isSubUrl() ? $prefix.$this->getValue() : $this->getValue(); |
|
142 | 142 | } |
143 | 143 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * Message code. |
42 | 42 | */ |
43 | - const MSG_INVALID_SCHEME ='Schema for type `%s` must be non-empty string, callable or SchemaInterface instance.'; |
|
43 | + const MSG_INVALID_SCHEME = 'Schema for type `%s` must be non-empty string, callable or SchemaInterface instance.'; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Message code. |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function __construct(FactoryInterface $factory, iterable $schemas) |
80 | 80 | { |
81 | - $this->factory = $factory; |
|
81 | + $this->factory = $factory; |
|
82 | 82 | $this->registerCollection($schemas); |
83 | 83 | } |
84 | 84 |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | $currentType = $this->getType(); |
178 | 178 | $currentPath = $this->getPosition()->getPath(); |
179 | 179 | $nextLevel = $this->getPosition()->getLevel() + 1; |
180 | - $nextPathPrefix = empty($currentPath) === true ? '' : $currentPath . PositionInterface::PATH_SEPARATOR; |
|
180 | + $nextPathPrefix = empty($currentPath) === true ? '' : $currentPath.PositionInterface::PATH_SEPARATOR; |
|
181 | 181 | foreach ($this->getSchema()->getRelationships($this->getData()) as $name => $description) { |
182 | 182 | assert( |
183 | 183 | is_string($name) === true && empty($name) === false, |
184 | - "Relationship names for type `" . $currentType .'` should be non-empty strings.' |
|
184 | + "Relationship names for type `".$currentType.'` should be non-empty strings.' |
|
185 | 185 | ); |
186 | 186 | assert( |
187 | 187 | is_array($description) === true && empty($description) === false, |
188 | - "Relationship `$name` for type `" . $currentType . '` should be a non-empty array.' |
|
188 | + "Relationship `$name` for type `".$currentType.'` should be a non-empty array.' |
|
189 | 189 | ); |
190 | 190 | |
191 | 191 | $hasData = array_key_exists(SchemaInterface::RELATIONSHIP_DATA, $description); |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | $hasLinks = $addSelfLink === true || $addRelatedLink === true || empty($schemaLinks) === false; |
233 | 233 | assert( |
234 | 234 | $hasData || $hasMeta || $hasLinks, |
235 | - "Relationship `$name` for type `" . $currentType . |
|
235 | + "Relationship `$name` for type `".$currentType. |
|
236 | 236 | '` MUST contain at least one of the following: links, data or meta.' |
237 | 237 | ); |
238 | 238 | |
239 | 239 | $nextPosition = $this->getFactory()->createPosition( |
240 | 240 | $nextLevel, |
241 | - $nextPathPrefix . $name, |
|
241 | + $nextPathPrefix.$name, |
|
242 | 242 | $currentType, |
243 | 243 | $name |
244 | 244 | ); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | /** @var string */ |
52 | 52 | public const MSG_CAN_NOT_PARSE_RELATIONSHIP = |
53 | - 'For resource of type `%s` with ID `%s` relationship `%s` cannot be parsed because it either ' . |
|
53 | + 'For resource of type `%s` with ID `%s` relationship `%s` cannot be parsed because it either '. |
|
54 | 54 | 'has `null` or identifier as data. Skipping.'; |
55 | 55 | |
56 | 56 | /** |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | $curPath = ''; |
547 | 547 | foreach (explode(DocumentInterface::PATH_SEPARATOR, $path) as $pathPart) { |
548 | 548 | $curPath = empty($curPath) === true ? |
549 | - $pathPart : $curPath . DocumentInterface::PATH_SEPARATOR . $pathPart; |
|
549 | + $pathPart : $curPath.DocumentInterface::PATH_SEPARATOR.$pathPart; |
|
550 | 550 | $normalizedPaths[$curPath] = true; |
551 | 551 | } |
552 | 552 | } |