@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function toObject(): \stdClass |
| 145 | 145 | { |
| 146 | - return (object) json_decode($this->toJson(), false); |
|
| 146 | + return (object)json_decode($this->toJson(), false); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | } elseif (\is_object($resource) && method_exists($resource, 'toArray')) { |
| 349 | 349 | $output = $resource->toArray(); |
| 350 | 350 | } else { |
| 351 | - throw new UnhandledResourceType('Unable to serialize resource of type '.\gettype($resource)); |
|
| 351 | + throw new UnhandledResourceType('Unable to serialize resource of type ' . \gettype($resource)); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | return $output; |
@@ -424,11 +424,11 @@ discard block |
||
| 424 | 424 | { |
| 425 | 425 | if ($transformer === null) { |
| 426 | 426 | // No transformation can be applied. |
| 427 | - return (array) $item; |
|
| 427 | + return (array)$item; |
|
| 428 | 428 | } |
| 429 | 429 | if (\is_callable($transformer)) { |
| 430 | 430 | // Callable should simply return an array. |
| 431 | - return (array) $transformer($item); |
|
| 431 | + return (array)$transformer($item); |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | // Only these keys may be mapped |
@@ -438,12 +438,12 @@ discard block |
||
| 438 | 438 | $wantIncludeKeys = $includes->baseKeys() ?: $transformer->getDefaultIncludes(); |
| 439 | 439 | |
| 440 | 440 | // Find the keys that are declared in the $includes of the transformer |
| 441 | - $mappedIncludeKeys = array_filter($wantIncludeKeys, function ($includeKey) use ($availableIncludeKeys) { |
|
| 441 | + $mappedIncludeKeys = array_filter($wantIncludeKeys, function($includeKey) use ($availableIncludeKeys) { |
|
| 442 | 442 | return \in_array($includeKey, $availableIncludeKeys, true); |
| 443 | 443 | }); |
| 444 | 444 | |
| 445 | 445 | // We can consider our props anything that has not been mapped. |
| 446 | - $filterProps = array_filter($wantIncludeKeys, function ($includeKey) use ($mappedIncludeKeys) { |
|
| 446 | + $filterProps = array_filter($wantIncludeKeys, function($includeKey) use ($mappedIncludeKeys) { |
|
| 447 | 447 | return !\in_array($includeKey, $mappedIncludeKeys, true); |
| 448 | 448 | }); |
| 449 | 449 | |
@@ -458,11 +458,11 @@ discard block |
||
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | // Get the base data from the transformation |
| 461 | - $data = (array) $transformer->transform($item); |
|
| 461 | + $data = (array)$transformer->transform($item); |
|
| 462 | 462 | |
| 463 | 463 | // Filter the sparse field-set |
| 464 | 464 | if (!empty($filterProps)) { |
| 465 | - $filteredData = array_filter($data, function ($key) use ($filterProps) { |
|
| 465 | + $filteredData = array_filter($data, function($key) use ($filterProps) { |
|
| 466 | 466 | return \in_array($key, $filterProps, true); |
| 467 | 467 | }, ARRAY_FILTER_USE_KEY); |
| 468 | 468 | |