@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $included = $included->merge($relation->getIncluded()); |
132 | 132 | } elseif ($relation instanceof IlluminateCollection) { |
133 | 133 | $relation->each( |
134 | - function (ItemInterface $item) use (&$included) { |
|
134 | + function(ItemInterface $item) use (&$included) { |
|
135 | 135 | if (!empty($item->getType()) && null !== $item->getId()) { |
136 | 136 | $included->push($item->toJsonApiArray()); |
137 | 137 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | return $included->unique( |
147 | - function (array $item) { |
|
147 | + function(array $item) { |
|
148 | 148 | return $item['type'].':'.$item['id']; |
149 | 149 | } |
150 | 150 | ); |
@@ -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 | ); |
@@ -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(), |
@@ -145,7 +145,7 @@ |
||
145 | 145 | $desiredObject = null; |
146 | 146 | |
147 | 147 | //check duplicate |
148 | - $desiredObject = $included->first(function ($item) use ($id, $type) { |
|
148 | + $desiredObject = $included->first(function($item) use ($id, $type) { |
|
149 | 149 | return ($item->getId() == $id) && ($item->getType() == $type); |
150 | 150 | }); |
151 | 151 | if (is_null($desiredObject)) { |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | public function hydrateRelationships(Collection $jsonApiItems, Collection $items) |
114 | 114 | { |
115 | 115 | $keyedItems = $items->reverse()->keyBy( |
116 | - function (ItemInterface $item) { |
|
116 | + function(ItemInterface $item) { |
|
117 | 117 | return $this->getItemKey($item); |
118 | 118 | } |
119 | 119 | ); |
120 | 120 | |
121 | 121 | $jsonApiItems->each( |
122 | - function ($jsonApiItem) use ($keyedItems) { |
|
122 | + function($jsonApiItem) use ($keyedItems) { |
|
123 | 123 | if (!$jsonApiItem->has('relationships')) { |
124 | 124 | return; |
125 | 125 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | { |
178 | 178 | return $included->get( |
179 | 179 | $this->getElementKey($identifier), |
180 | - function () { |
|
180 | + function() { |
|
181 | 181 | return new NullItem(); |
182 | 182 | } |
183 | 183 | ); |