@@ -33,7 +33,7 @@ |
||
33 | 33 | */ |
34 | 34 | protected function getRelationshipKeys(ResourceInterface $resource): array |
35 | 35 | { |
36 | - $keys = []; |
|
36 | + $keys = [ ]; |
|
37 | 37 | foreach ($resource->getRelationships() as $key => $relationships) { |
38 | 38 | if (!empty($relationships)) { |
39 | 39 | array_push($keys, ...$relationships); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | public function boot() |
16 | 16 | { |
17 | 17 | $this->publishes([ |
18 | - __DIR__.'/../../config/smokescreen.php' => config_path('smokescreen.php'), |
|
18 | + __DIR__ . '/../../config/smokescreen.php' => config_path('smokescreen.php'), |
|
19 | 19 | ], 'config'); |
20 | 20 | } |
21 | 21 | |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function register() |
28 | 28 | { |
29 | - $this->app->singleton(Smokescreen::class, function () { |
|
30 | - return new Smokescreen(new \Rexlabs\Smokescreen\Smokescreen(), config('smokescreen', [])); |
|
29 | + $this->app->singleton(Smokescreen::class, function() { |
|
30 | + return new Smokescreen(new \Rexlabs\Smokescreen\Smokescreen(), config('smokescreen', [ ])); |
|
31 | 31 | }); |
32 | 32 | $this->app->alias(Smokescreen::class, 'smokescreen'); |
33 | 33 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param \Rexlabs\Smokescreen\Smokescreen $smokescreen |
75 | 75 | * @param array $config |
76 | 76 | */ |
77 | - public function __construct(\Rexlabs\Smokescreen\Smokescreen $smokescreen, array $config = []) |
|
77 | + public function __construct(\Rexlabs\Smokescreen\Smokescreen $smokescreen, array $config = [ ]) |
|
78 | 78 | { |
79 | 79 | $this->smokescreen = $smokescreen; |
80 | 80 | $this->setConfig($config); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return static |
90 | 90 | */ |
91 | - public static function make(\Rexlabs\Smokescreen\Smokescreen $smokescreen = null, array $config = []) |
|
91 | + public static function make(\Rexlabs\Smokescreen\Smokescreen $smokescreen = null, array $config = [ ]) |
|
92 | 92 | { |
93 | 93 | return new static($smokescreen ?? new \Rexlabs\Smokescreen\Smokescreen(), $config); |
94 | 94 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } elseif ($data instanceof Builder) { |
226 | 226 | $data = $data->get(); |
227 | 227 | } elseif ($data instanceof Model) { |
228 | - $data = new Collection([$data]); |
|
228 | + $data = new Collection([ $data ]); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // Create a new collection resource |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | // underlying model and attempt to resolve a transformer class. |
396 | 396 | if ($this->smokescreen->getTransformerResolver() === null) { |
397 | 397 | $this->smokescreen->setTransformerResolver( |
398 | - new TransformerResolver($this->config['transformer_namespace'] ?? 'App\\Transformers') |
|
398 | + new TransformerResolver($this->config[ 'transformer_namespace' ] ?? 'App\\Transformers') |
|
399 | 399 | ); |
400 | 400 | } |
401 | 401 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | return $this->autoParseIncludes; |
441 | 441 | } |
442 | 442 | |
443 | - return $this->config['include_key'] ?? 'include'; |
|
443 | + return $this->config[ 'include_key' ] ?? 'include'; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | /** |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @see Smokescreen::toArray() |
482 | 482 | */ |
483 | - public function response(int $statusCode = 200, array $headers = [], int $options = 0): JsonResponse |
|
483 | + public function response(int $statusCode = 200, array $headers = [ ], int $options = 0): JsonResponse |
|
484 | 484 | { |
485 | 485 | // Response will only be generated once. use clearResponse() to clear. |
486 | 486 | if ($this->response === null) { |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @see Smokescreen::toArray() |
509 | 509 | * @see Smokescreen::response() |
510 | 510 | */ |
511 | - public function freshResponse(int $statusCode = 200, array $headers = [], int $options = 0): JsonResponse |
|
511 | + public function freshResponse(int $statusCode = 200, array $headers = [ ], int $options = 0): JsonResponse |
|
512 | 512 | { |
513 | 513 | $this->clearResponse(); |
514 | 514 | |
@@ -625,15 +625,15 @@ discard block |
||
625 | 625 | */ |
626 | 626 | protected function setConfig(array $config) |
627 | 627 | { |
628 | - if (!empty($config['default_serializer'])) { |
|
629 | - $serializer = $config['default_serializer']; |
|
628 | + if (!empty($config[ 'default_serializer' ])) { |
|
629 | + $serializer = $config[ 'default_serializer' ]; |
|
630 | 630 | if (\is_string($serializer)) { |
631 | 631 | // Given serializer is expected to be a class path |
632 | 632 | // Instantiate via the container |
633 | 633 | $serializer = app()->make($serializer); |
634 | 634 | } |
635 | 635 | $this->serializeWith($serializer); |
636 | - unset($config['default_serializer']); |
|
636 | + unset($config[ 'default_serializer' ]); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | $this->config = $config; |