@@ -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; |
@@ -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 | ); |
@@ -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; |
@@ -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 getIncludePaths(array $parameters, string $errorTitle): iterable |
55 | 55 | { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param array $parameters |
65 | 65 | * @param string $errorTitle |
66 | 66 | * |
67 | - * @return iterable |
|
67 | + * @return \Generator |
|
68 | 68 | */ |
69 | 69 | protected function getFields(array $parameters, string $errorTitle): iterable |
70 | 70 | { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param array $parameters |
85 | 85 | * @param string $errorTitle |
86 | 86 | * |
87 | - * @return iterable |
|
87 | + * @return \Generator |
|
88 | 88 | */ |
89 | 89 | protected function getSorts(array $parameters, string $errorTitle): iterable |
90 | 90 | { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param array $parameters |
117 | 117 | * @param string $errorTitle |
118 | 118 | * |
119 | - * @return iterable |
|
119 | + * @return \Generator |
|
120 | 120 | */ |
121 | 121 | protected function getProfileUrls(array $parameters, string $errorTitle): iterable |
122 | 122 | { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @param string|mixed $shouldBeString |
137 | 137 | * @param string $errorTitle |
138 | 138 | * |
139 | - * @return iterable |
|
139 | + * @return \Generator |
|
140 | 140 | */ |
141 | 141 | private function splitCommaSeparatedStringAndCheckNoEmpties( |
142 | 142 | string $paramName, |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | |
149 | 149 | /** |
150 | 150 | * @param string $paramName |
151 | - * @param string|mixed $shouldBeString |
|
151 | + * @param string $shouldBeString |
|
152 | 152 | * @param string $errorTitle |
153 | 153 | * |
154 | - * @return iterable |
|
154 | + * @return \Generator |
|
155 | 155 | */ |
156 | 156 | private function splitSpaceSeparatedStringAndCheckNoEmpties( |
157 | 157 | string $paramName, |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param string $separator |
168 | 168 | * @param string $errorTitle |
169 | 169 | * |
170 | - * @return iterable |
|
170 | + * @return \Generator |
|
171 | 171 | * |
172 | 172 | * @SuppressWarnings(PHPMD.IfStatementAssignment) |
173 | 173 | */ |
@@ -131,8 +131,7 @@ |
||
131 | 131 | $this->parsedResources = []; |
132 | 132 | foreach ($this->resources as $resourceOrIdentifier) { |
133 | 133 | $parsedResource = $resourceOrIdentifier instanceof SchemaIdentifierInterface ? |
134 | - $this->createParsedIdentifier($resourceOrIdentifier) : |
|
135 | - $this->createParsedResource($resourceOrIdentifier); |
|
134 | + $this->createParsedIdentifier($resourceOrIdentifier) : $this->createParsedResource($resourceOrIdentifier); |
|
136 | 135 | $this->parsedResources[] = $parsedResource; |
137 | 136 | |
138 | 137 | yield $parsedResource; |