@@ -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 |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $this->app->singleton( |
| 48 | 48 | TypeMapperInterface::class, |
| 49 | - function () { |
|
| 49 | + function() { |
|
| 50 | 50 | return new TypeMapper(); |
| 51 | 51 | } |
| 52 | 52 | ); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $this->app->bind( |
| 58 | 58 | ParserInterface::class, |
| 59 | - function (Application $app) { |
|
| 59 | + function(Application $app) { |
|
| 60 | 60 | return new Parser( |
| 61 | 61 | new JsonApiClientManger(), |
| 62 | 62 | new Hydrator($app->make(TypeMapperInterface::class)), |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | { |
| 71 | 71 | $this->app->bind( |
| 72 | 72 | ApiClientInterface::class, |
| 73 | - function () { |
|
| 73 | + function() { |
|
| 74 | 74 | return new ApiClient( |
| 75 | 75 | $this->getHttpClient(), |
| 76 | 76 | config('jsonapi.base_uri'), |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $this->app->bind( |
| 83 | 83 | ApiDocumentClientInterface::class, |
| 84 | - function (Application $app) { |
|
| 84 | + function(Application $app) { |
|
| 85 | 85 | return new ApiDocumentClient( |
| 86 | 86 | $app->make(ApiClientInterface::class), |
| 87 | 87 | new ItemDocumentSerializer(), |
@@ -67,13 +67,13 @@ |
||
| 67 | 67 | public function hydrateRelationships(Collection $jsonApiItems, Collection $items) |
| 68 | 68 | { |
| 69 | 69 | $keyedItems = $items->reverse()->keyBy( |
| 70 | - function (ItemInterface $item) { |
|
| 70 | + function(ItemInterface $item) { |
|
| 71 | 71 | return $this->getItemKey($item); |
| 72 | 72 | } |
| 73 | 73 | ); |
| 74 | 74 | |
| 75 | 75 | $jsonApiItems->each( |
| 76 | - function (ResourceItemInterface $jsonApiItem) use ($keyedItems) { |
|
| 76 | + function(ResourceItemInterface $jsonApiItem) use ($keyedItems) { |
|
| 77 | 77 | if (!$jsonApiItem->has('relationships')) { |
| 78 | 78 | return; |
| 79 | 79 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $included = $included->merge($includedFromRelationship->getIncluded()); |
| 201 | 201 | } elseif ($includedFromRelationship instanceof Collection) { |
| 202 | 202 | $includedFromRelationship->each( |
| 203 | - function (ItemInterface $item) use (&$included) { |
|
| 203 | + function(ItemInterface $item) use (&$included) { |
|
| 204 | 204 | if (!empty($item->getType()) && null !== $item->getId()) { |
| 205 | 205 | $included->push($item->toJsonApiArray()); |
| 206 | 206 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | return $included->unique( |
| 216 | - function (array $item) { |
|
| 216 | + function(array $item) { |
|
| 217 | 217 | return $item['type'].':'.$item['id']; |
| 218 | 218 | } |
| 219 | 219 | ); |