@@ -96,7 +96,7 @@ |
||
| 96 | 96 | { |
| 97 | 97 | return array_reduce( |
| 98 | 98 | $this->pipes, |
| 99 | - function ($data, CanPipe $middleware) use ($resource, $context, $path) { |
|
| 99 | + function($data, CanPipe $middleware) use ($resource, $context, $path) { |
|
| 100 | 100 | return $middleware->pipe($resource, $context, $path, $data); |
| 101 | 101 | }, |
| 102 | 102 | $data |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | private function assertCanAccess($resource, Context $context, Path $path): void { |
| 64 | 64 | $transformer = $this->transformerRepository->getTransformer($resource); |
| 65 | 65 | |
| 66 | - if (! $transformer instanceof HasAccessConfig) { |
|
| 66 | + if (!$transformer instanceof HasAccessConfig) { |
|
| 67 | 67 | return; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | foreach ($allAcl as $acl) { |
| 79 | 79 | $guard = $this->guardByName[$acl]; |
| 80 | 80 | |
| 81 | - if (! $guard->canAccess($resource, $context)) { |
|
| 81 | + if (!$guard->canAccess($resource, $context)) { |
|
| 82 | 82 | throw new AccessDeniedException('test'); |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | private function pick(array $array, array $keys) |
| 88 | 88 | { |
| 89 | - return array_filter($array, function (string $key) use ($keys): bool { |
|
| 89 | + return array_filter($array, function(string $key) use ($keys): bool { |
|
| 90 | 90 | return in_array($key, $keys, true); |
| 91 | 91 | }, ARRAY_FILTER_USE_KEY); |
| 92 | 92 | } |
@@ -100,15 +100,15 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | private function getProperties(array $schema): array |
| 102 | 102 | { |
| 103 | - return array_map(function ($value, $key) { |
|
| 103 | + return array_map(function($value, $key) { |
|
| 104 | 104 | return is_string($value) ? $value : $key; |
| 105 | 105 | }, $schema, array_keys($schema)); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | private function getPathSchema(Path $path, array $schema): array |
| 109 | 109 | { |
| 110 | - $segments = array_filter($path->getSegments(), function ($segment) { |
|
| 111 | - return ! is_numeric($segment); |
|
| 110 | + $segments = array_filter($path->getSegments(), function($segment) { |
|
| 111 | + return !is_numeric($segment); |
|
| 112 | 112 | }); |
| 113 | 113 | |
| 114 | 114 | return $this->arrayGet($schema, $segments, []); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | private function arrayGet(array $array, array $path, $default): array |
| 118 | 118 | { |
| 119 | 119 | foreach ($path as $key) { |
| 120 | - if (! array_key_exists($key, $array)) { |
|
| 120 | + if (!array_key_exists($key, $array)) { |
|
| 121 | 121 | return $default; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function pipe($resource, Context $context, Path $path, $data) |
| 35 | 35 | { |
| 36 | - if (! $context instanceof HasSchema) { |
|
| 36 | + if (!$context instanceof HasSchema) { |
|
| 37 | 37 | return $data; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $transformer = $this->transformerRepository->getTransformer($resource); |
| 41 | 41 | |
| 42 | - if (! $transformer instanceof HasLazyProperties) { |
|
| 42 | + if (!$transformer instanceof HasLazyProperties) { |
|
| 43 | 43 | return $data; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | return array_reduce( |
| 51 | 51 | $properties, |
| 52 | - function (array $data, string $key) use ($resource, $transformer) { |
|
| 53 | - if (! array_key_exists($key, $data)) { |
|
| 52 | + function(array $data, string $key) use ($resource, $transformer) { |
|
| 53 | + if (!array_key_exists($key, $data)) { |
|
| 54 | 54 | $data[$key] = $transformer->{$key}($resource); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -62,15 +62,15 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | private function getProperties(array $schema): array |
| 64 | 64 | { |
| 65 | - return array_map(function ($value, $key) { |
|
| 65 | + return array_map(function($value, $key) { |
|
| 66 | 66 | return is_string($value) ? $value : $key; |
| 67 | 67 | }, $schema, array_keys($schema)); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | private function getPathSchema(Path $path, array $schema): array |
| 71 | 71 | { |
| 72 | - $segments = array_filter($path->getSegments(), function ($segment) { |
|
| 73 | - return ! is_numeric($segment); |
|
| 72 | + $segments = array_filter($path->getSegments(), function($segment) { |
|
| 73 | + return !is_numeric($segment); |
|
| 74 | 74 | }); |
| 75 | 75 | |
| 76 | 76 | return $this->arrayGet($schema, $segments, []); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | private function arrayGet(array $array, array $path, $default): array |
| 80 | 80 | { |
| 81 | 81 | foreach ($path as $key) { |
| 82 | - if (! array_key_exists($key, $array)) { |
|
| 82 | + if (!array_key_exists($key, $array)) { |
|
| 83 | 83 | return $default; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | $lastKey = array_pop($path); |
| 10 | 10 | $current = &$array; |
| 11 | 11 | |
| 12 | - foreach($path as $key) { |
|
| 12 | + foreach ($path as $key) { |
|
| 13 | 13 | $current = &$current[$key]; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | |
| 21 | 21 | public static function map(array $resources) |
| 22 | 22 | { |
| 23 | - return array_map(function (array $resource) { |
|
| 23 | + return array_map(function(array $resource) { |
|
| 24 | 24 | return new static($resource); |
| 25 | 25 | }, $resources); |
| 26 | 26 | } |
@@ -19,11 +19,11 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function pipe($resource, Context $context, Path $path, $data) |
| 21 | 21 | { |
| 22 | - if (! $context instanceof HasTimezone) { |
|
| 22 | + if (!$context instanceof HasTimezone) { |
|
| 23 | 23 | return $data; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - if (! $resource instanceof DateTime) { |
|
| 26 | + if (!$resource instanceof DateTime) { |
|
| 27 | 27 | return $data; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function pipe($resource, Context $context, Path $path, $data) |
| 34 | 34 | { |
| 35 | - if (! $context instanceof HasSchema) { |
|
| 35 | + if (!$context instanceof HasSchema) { |
|
| 36 | 36 | return $data; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | private function getProperties(array $schema): array |
| 52 | 52 | { |
| 53 | - return array_map(function ($value, $key) { |
|
| 53 | + return array_map(function($value, $key) { |
|
| 54 | 54 | return is_string($value) ? $value : $key; |
| 55 | 55 | }, $schema, array_keys($schema)); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | private function getPathSchema(Path $path, array $schema): array |
| 59 | 59 | { |
| 60 | - $segments = array_filter($path->getSegments(), function ($segment) { |
|
| 61 | - return ! is_numeric($segment); |
|
| 60 | + $segments = array_filter($path->getSegments(), function($segment) { |
|
| 61 | + return !is_numeric($segment); |
|
| 62 | 62 | }); |
| 63 | 63 | |
| 64 | 64 | return $this->arrayGet($schema, $segments, []); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | private function arrayGet(array $array, array $path, $default): array |
| 68 | 68 | { |
| 69 | 69 | foreach ($path as $key) { |
| 70 | - if (! array_key_exists($key, $array)) { |
|
| 70 | + if (!array_key_exists($key, $array)) { |
|
| 71 | 71 | return $default; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | protected function transformAny($deferred, Context $context, Path $path) |
| 50 | 50 | { |
| 51 | - if (! $deferred instanceof Deferred) { |
|
| 51 | + if (!$deferred instanceof Deferred) { |
|
| 52 | 52 | return parent::transformAny($deferred, $context, $path); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $property = $deferred->getProperty(); |
| 57 | 57 | $resourceClass = get_class($resource); |
| 58 | 58 | |
| 59 | - $this->deferredTree = Arr::setValue($this->deferredTree, [$resourceClass, $property, (string)$path], $deferred); |
|
| 59 | + $this->deferredTree = Arr::setValue($this->deferredTree, [$resourceClass, $property, (string) $path], $deferred); |
|
| 60 | 60 | |
| 61 | 61 | return null; |
| 62 | 62 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if (! empty($this->deferredTree)) { |
|
| 92 | + if (!empty($this->deferredTree)) { |
|
| 93 | 93 | return $this->loadDeferred($result, $context); |
| 94 | 94 | } |
| 95 | 95 | |