@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public function toJsonApiArray(): array |
| 15 | 15 | { |
| 16 | 16 | return array_map( |
| 17 | - function ($value) { |
|
| 17 | + function($value) { |
|
| 18 | 18 | return $value instanceof DataInterface ? $value->toJsonApiArray() : $value; |
| 19 | 19 | }, |
| 20 | 20 | $this->items |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | return Collection::wrap($data) |
| 36 | 36 | ->flatMap( |
| 37 | - function (ItemInterface $item) { |
|
| 37 | + function(ItemInterface $item) { |
|
| 38 | 38 | return $this->getIncludedFromItem($item); |
| 39 | 39 | } |
| 40 | 40 | ) |
| 41 | 41 | ->unique( |
| 42 | - static function (ItemInterface $item) { |
|
| 42 | + static function(ItemInterface $item) { |
|
| 43 | 43 | return sprintf('%s:%s', $item->getType(), $item->getId()); |
| 44 | 44 | } |
| 45 | 45 | ) |
@@ -55,24 +55,24 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | return Collection::make($item->getRelations()) |
| 57 | 57 | ->reject( |
| 58 | - static function ($relationship) { |
|
| 58 | + static function($relationship) { |
|
| 59 | 59 | /* @var \Swis\JsonApi\Client\Interfaces\OneRelationInterface|\Swis\JsonApi\Client\Interfaces\ManyRelationInterface $relationship */ |
| 60 | 60 | return $relationship->shouldOmitIncluded() || !$relationship->hasIncluded(); |
| 61 | 61 | } |
| 62 | 62 | ) |
| 63 | 63 | ->flatMap( |
| 64 | - static function ($relationship) { |
|
| 64 | + static function($relationship) { |
|
| 65 | 65 | /* @var \Swis\JsonApi\Client\Interfaces\OneRelationInterface|\Swis\JsonApi\Client\Interfaces\ManyRelationInterface $relationship */ |
| 66 | 66 | return Collection::wrap($relationship->getIncluded()); |
| 67 | 67 | } |
| 68 | 68 | ) |
| 69 | 69 | ->flatMap( |
| 70 | - function (ItemInterface $item) { |
|
| 70 | + function(ItemInterface $item) { |
|
| 71 | 71 | return Collection::wrap($item)->merge($this->getIncludedFromItem($item)); |
| 72 | 72 | } |
| 73 | 73 | ) |
| 74 | 74 | ->filter( |
| 75 | - function (ItemInterface $item) { |
|
| 75 | + function(ItemInterface $item) { |
|
| 76 | 76 | return $this->itemCanBeIncluded($item); |
| 77 | 77 | } |
| 78 | 78 | ); |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | |
| 40 | 40 | return new ErrorCollection( |
| 41 | 41 | array_map( |
| 42 | - function ($error) { |
|
| 42 | + function($error) { |
|
| 43 | 43 | return $this->errorParser->parse($error); |
| 44 | 44 | }, |
| 45 | 45 | $data |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | |
| 37 | 37 | return Collection::make($data) |
| 38 | 38 | ->map( |
| 39 | - function ($item) { |
|
| 39 | + function($item) { |
|
| 40 | 40 | return $this->itemParser->parse($item); |
| 41 | 41 | } |
| 42 | 42 | ); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | if (property_exists($data, 'attributes')) { |
| 82 | - $item->fill((array) $data->attributes); |
|
| 82 | + $item->fill((array)$data->attributes); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | if (property_exists($data, 'relationships')) { |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | if (is_array($data)) { |
| 167 | 167 | return Collection::make($data) |
| 168 | 168 | ->map( |
| 169 | - function ($identifier) { |
|
| 169 | + function($identifier) { |
|
| 170 | 170 | return $this->parseRelationshipData($identifier); |
| 171 | 171 | } |
| 172 | 172 | ); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $document = new InvalidResponseDocument(); |
| 35 | 35 | |
| 36 | 36 | if ($this->responseHasBody($response)) { |
| 37 | - $document = $this->parser->parse((string) $response->getBody()); |
|
| 37 | + $document = $this->parser->parse((string)$response->getBody()); |
|
| 38 | 38 | } elseif ($this->responseHasSuccessfulStatusCode($response)) { |
| 39 | 39 | $document = new Document(); |
| 40 | 40 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | private function responseHasBody(ResponseInterface $response): bool |
| 53 | 53 | { |
| 54 | - return (bool) $response->getBody()->getSize(); |
|
| 54 | + return (bool)$response->getBody()->getSize(); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -57,9 +57,9 @@ |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | return new Links( |
| 60 | - Collection::wrap((array) $data) |
|
| 60 | + Collection::wrap((array)$data) |
|
| 61 | 61 | ->map( |
| 62 | - function ($link, $name) { |
|
| 62 | + function($link, $name) { |
|
| 63 | 63 | return $this->buildLink($link, $name); |
| 64 | 64 | } |
| 65 | 65 | ) |
@@ -34,6 +34,6 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function hasType(): bool |
| 36 | 36 | { |
| 37 | - return (bool) $this->type; |
|
| 37 | + return (bool)$this->type; |
|
| 38 | 38 | } |
| 39 | 39 | } |
@@ -21,6 +21,6 @@ |
||
| 21 | 21 | throw new ValidationException(sprintf('Meta MUST be an object, "%s" given.', gettype($data))); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - return new Meta((array) $data); |
|
| 24 | + return new Meta((array)$data); |
|
| 25 | 25 | } |
| 26 | 26 | } |