@@ -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 |
@@ -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 | } |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | public function toArray() |
| 113 | 113 | { |
| 114 | 114 | return array_map( |
| 115 | - function (Link $link) { |
|
| 115 | + function(Link $link) { |
|
| 116 | 116 | return $link->toArray(); |
| 117 | 117 | }, |
| 118 | 118 | $this->links |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | { |
| 19 | 19 | return new Links( |
| 20 | 20 | array_map( |
| 21 | - function ($link) { |
|
| 21 | + function($link) { |
|
| 22 | 22 | return $this->buildLink($link); |
| 23 | 23 | }, |
| 24 | 24 | $links |
@@ -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), new LinksParser()), |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $this->app->bind( |
| 73 | 73 | ApiClientInterface::class, |
| 74 | - function () { |
|
| 74 | + function() { |
|
| 75 | 75 | return new ApiClient( |
| 76 | 76 | $this->getHttpClient(), |
| 77 | 77 | config('jsonapi.base_uri'), |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $this->app->bind( |
| 84 | 84 | ApiDocumentClientInterface::class, |
| 85 | - function (Application $app) { |
|
| 85 | + function(Application $app) { |
|
| 86 | 86 | return new ApiDocumentClient( |
| 87 | 87 | $app->make(ApiClientInterface::class), |
| 88 | 88 | $app->make(ParserInterface::class) |
@@ -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 | ); |