@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | // Feel free to override this method to change default URL or add meta |
| 76 | 76 | |
| 77 | - $url = $this->getSelfSubUrl($resource) . '/' . DocumentInterface::KEYWORD_RELATIONSHIPS . '/' . $name; |
|
| 77 | + $url = $this->getSelfSubUrl($resource).'/'.DocumentInterface::KEYWORD_RELATIONSHIPS.'/'.$name; |
|
| 78 | 78 | |
| 79 | 79 | return $this->factory->createLink(true, $url, false); |
| 80 | 80 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | // Feel free to override this method to change default URL or add meta |
| 88 | 88 | |
| 89 | - $url = $this->getSelfSubUrl($resource) . '/' . $name; |
|
| 89 | + $url = $this->getSelfSubUrl($resource).'/'.$name; |
|
| 90 | 90 | |
| 91 | 91 | return $this->factory->createLink(true, $url, false); |
| 92 | 92 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | protected function getResourcesSubUrl(): string |
| 158 | 158 | { |
| 159 | 159 | if ($this->subUrl === null) { |
| 160 | - $this->subUrl = '/' . $this->getType(); |
|
| 160 | + $this->subUrl = '/'.$this->getType(); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | return $this->subUrl; |
@@ -170,6 +170,6 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | protected function getSelfSubUrl($resource): string |
| 172 | 172 | { |
| 173 | - return $this->getResourcesSubUrl() . '/' . $this->getId($resource); |
|
| 173 | + return $this->getResourcesSubUrl().'/'.$this->getId($resource); |
|
| 174 | 174 | } |
| 175 | 175 | } |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | public function getMediaType(): string |
| 100 | 100 | { |
| 101 | 101 | if ($this->mediaType === null) { |
| 102 | - $this->mediaType = $this->type . '/' . $this->getSubType(); |
|
| 102 | + $this->mediaType = $this->type.'/'.$this->getSubType(); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | return $this->mediaType; |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | if (empty($attributes) === false) { |
| 269 | 269 | \assert( |
| 270 | 270 | \json_encode($attributes) !== false, |
| 271 | - 'Attributes for resource type `' . $resource->getType() . |
|
| 271 | + 'Attributes for resource type `'.$resource->getType(). |
|
| 272 | 272 | '` cannot be converted into JSON. Please check its Schema returns valid data.' |
| 273 | 273 | ); |
| 274 | 274 | $representation[DocumentInterface::KEYWORD_ATTRIBUTES] = $attributes; |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | if (empty($relationships) === false) { |
| 279 | 279 | \assert( |
| 280 | 280 | \json_encode($relationships) !== false, |
| 281 | - 'Relationships for resource type `' . $resource->getType() . |
|
| 281 | + 'Relationships for resource type `'.$resource->getType(). |
|
| 282 | 282 | '` cannot be converted into JSON. Please check its Schema returns valid data.' |
| 283 | 283 | ); |
| 284 | 284 | $representation[DocumentInterface::KEYWORD_RELATIONSHIPS] = $relationships; |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $links = $this->getLinksRepresentation($this->getUrlPrefix(), $resource->getLinks()); |
| 289 | 289 | \assert( |
| 290 | 290 | \json_encode($links) !== false, |
| 291 | - 'Links for resource type `' . $resource->getType() . |
|
| 291 | + 'Links for resource type `'.$resource->getType(). |
|
| 292 | 292 | '` cannot be converted into JSON. Please check its Schema returns valid data.' |
| 293 | 293 | ); |
| 294 | 294 | $representation[DocumentInterface::KEYWORD_LINKS] = $links; |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | $meta = $resource->getResourceMeta(); |
| 299 | 299 | \assert( |
| 300 | 300 | \json_encode($meta) !== false, |
| 301 | - 'Meta for resource type `' . $resource->getType() . |
|
| 301 | + 'Meta for resource type `'.$resource->getType(). |
|
| 302 | 302 | '` cannot be converted into JSON. Please check its Schema returns valid data.' |
| 303 | 303 | ); |
| 304 | 304 | $representation[DocumentInterface::KEYWORD_META] = $meta; |
@@ -127,8 +127,7 @@ |
||
| 127 | 127 | if ($this->parsedResources === null) { |
| 128 | 128 | foreach ($this->resources as $resourceOrIdentifier) { |
| 129 | 129 | $parsedResource = $resourceOrIdentifier instanceof SchemaIdentifierInterface ? |
| 130 | - $this->createParsedIdentifier($resourceOrIdentifier) : |
|
| 131 | - $this->createParsedResource($resourceOrIdentifier); |
|
| 130 | + $this->createParsedIdentifier($resourceOrIdentifier) : $this->createParsedResource($resourceOrIdentifier); |
|
| 132 | 131 | $this->parsedResources[] = $parsedResource; |
| 133 | 132 | |
| 134 | 133 | yield $parsedResource; |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | \assert( |
| 207 | 207 | \call_user_func( |
| 208 | - function (array $paths): bool { |
|
| 208 | + function(array $paths): bool { |
|
| 209 | 209 | $pathsOk = true; |
| 210 | 210 | foreach ($paths as $path) { |
| 211 | 211 | $pathsOk = $pathsOk === true && \is_string($path) === true && empty($path) === false; |
@@ -301,8 +301,7 @@ discard block |
||
| 301 | 301 | public function withLinks(iterable $links): EncoderInterface |
| 302 | 302 | { |
| 303 | 303 | $this->links = $this->hasLinks() === false ? |
| 304 | - $links : |
|
| 305 | - $this->links = \array_merge( |
|
| 304 | + $links : $this->links = \array_merge( |
|
| 306 | 305 | $this->iterableToArray($this->getLinks()), |
| 307 | 306 | $this->iterableToArray($links) |
| 308 | 307 | ); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param array $parameters |
| 33 | 33 | * @param string $errorTitle |
| 34 | 34 | * |
| 35 | - * @return iterable |
|
| 35 | + * @return \Generator |
|
| 36 | 36 | */ |
| 37 | 37 | protected function getIncludes(array $parameters, string $errorTitle): iterable |
| 38 | 38 | { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @param array $parameters |
| 50 | 50 | * @param string $errorTitle |
| 51 | 51 | * |
| 52 | - * @return iterable |
|
| 52 | + * @return \Generator |
|
| 53 | 53 | */ |
| 54 | 54 | protected function getFields(array $parameters, string $errorTitle): iterable |
| 55 | 55 | { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param array $parameters |
| 70 | 70 | * @param string $errorTitle |
| 71 | 71 | * |
| 72 | - * @return iterable |
|
| 72 | + * @return \Generator |
|
| 73 | 73 | */ |
| 74 | 74 | protected function getSorts(array $parameters, string $errorTitle): iterable |
| 75 | 75 | { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @param array $parameters |
| 102 | 102 | * @param string $errorTitle |
| 103 | 103 | * |
| 104 | - * @return iterable |
|
| 104 | + * @return \Generator |
|
| 105 | 105 | */ |
| 106 | 106 | protected function getProfileUrls(array $parameters, string $errorTitle): iterable |
| 107 | 107 | { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @param string|mixed $shouldBeString |
| 122 | 122 | * @param string $errorTitle |
| 123 | 123 | * |
| 124 | - * @return iterable |
|
| 124 | + * @return \Generator |
|
| 125 | 125 | */ |
| 126 | 126 | private function splitCommaSeparatedStringAndCheckNoEmpties( |
| 127 | 127 | string $paramName, |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * @param string $paramName |
| 136 | - * @param string|mixed $shouldBeString |
|
| 136 | + * @param string $shouldBeString |
|
| 137 | 137 | * @param string $errorTitle |
| 138 | 138 | * |
| 139 | - * @return iterable |
|
| 139 | + * @return \Generator |
|
| 140 | 140 | */ |
| 141 | 141 | private function splitSpaceSeparatedStringAndCheckNoEmpties( |
| 142 | 142 | string $paramName, |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @param string $separator |
| 153 | 153 | * @param string $errorTitle |
| 154 | 154 | * |
| 155 | - * @return iterable |
|
| 155 | + * @return \Generator |
|
| 156 | 156 | * |
| 157 | 157 | * @SuppressWarnings(PHPMD.IfStatementAssignment) |
| 158 | 158 | */ |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | $currentPath = $this->position->getPath(); |
| 187 | 187 | $nextLevel = $this->position->getLevel() + 1; |
| 188 | - $nextPathPrefix = empty($currentPath) === true ? '' : $currentPath . PositionInterface::PATH_SEPARATOR; |
|
| 188 | + $nextPathPrefix = empty($currentPath) === true ? '' : $currentPath.PositionInterface::PATH_SEPARATOR; |
|
| 189 | 189 | $this->getContext()->setPosition($this->getPosition()); |
| 190 | 190 | foreach ($this->schema->getRelationships($this->data, $this->getContext()) as $name => $description) { |
| 191 | 191 | \assert($this->assertRelationshipNameAndDescription($name, $description) === true); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | \assert( |
| 211 | 211 | $hasData || $hasMeta || $hasLinks, |
| 212 | - "Relationship `$name` for type `" . $this->getType() . |
|
| 212 | + "Relationship `$name` for type `".$this->getType(). |
|
| 213 | 213 | '` MUST contain at least one of the following: links, data or meta.' |
| 214 | 214 | ); |
| 215 | 215 | |
@@ -298,11 +298,11 @@ discard block |
||
| 298 | 298 | { |
| 299 | 299 | \assert( |
| 300 | 300 | \is_string($name) === true && empty($name) === false, |
| 301 | - "Relationship names for type `" . $this->getType() . '` should be non-empty strings.' |
|
| 301 | + "Relationship names for type `".$this->getType().'` should be non-empty strings.' |
|
| 302 | 302 | ); |
| 303 | 303 | \assert( |
| 304 | 304 | \is_array($description) === true && empty($description) === false, |
| 305 | - "Relationship `$name` for type `" . $this->getType() . '` should be a non-empty array.' |
|
| 305 | + "Relationship `$name` for type `".$this->getType().'` should be a non-empty array.' |
|
| 306 | 306 | ); |
| 307 | 307 | |
| 308 | 308 | return true; |