@@ -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 | |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | protected function transformAny($resource, Context $context, Path $path) |
| 50 | 50 | { |
| 51 | - if (! $resource instanceof Deferred) { |
|
| 51 | + if (!$resource instanceof Deferred) { |
|
| 52 | 52 | return parent::transformAny($resource, $context, $path); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -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 | } |