@@ -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 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param \Rexlabs\Smokescreen\Smokescreen $smokescreen |
74 | 74 | * @param array $config |
75 | 75 | */ |
76 | - public function __construct(\Rexlabs\Smokescreen\Smokescreen $smokescreen, array $config = []) |
|
76 | + public function __construct(\Rexlabs\Smokescreen\Smokescreen $smokescreen, array $config = [ ]) |
|
77 | 77 | { |
78 | 78 | $this->smokescreen = $smokescreen; |
79 | 79 | $this->config = $config; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return static |
89 | 89 | */ |
90 | - public static function make(\Rexlabs\Smokescreen\Smokescreen $smokescreen = null, array $config = []) |
|
90 | + public static function make(\Rexlabs\Smokescreen\Smokescreen $smokescreen = null, array $config = [ ]) |
|
91 | 91 | { |
92 | 92 | return new static($smokescreen ?? new \Rexlabs\Smokescreen\Smokescreen(), $config); |
93 | 93 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | } elseif ($data instanceof Builder) { |
224 | 224 | $data = $data->get(); |
225 | 225 | } elseif ($data instanceof Model) { |
226 | - $data = new Collection([$data]); |
|
226 | + $data = new Collection([ $data ]); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | // Create a new collection resource |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | // Serializer may be overridden via config |
370 | 370 | // We may be setting the serializer to null, in which case a default will be provided. |
371 | - $serializer = $this->serializer ?? $this->config['default_serializer'] ?? null; |
|
371 | + $serializer = $this->serializer ?? $this->config[ 'default_serializer' ] ?? null; |
|
372 | 372 | $this->smokescreen->setSerializer($serializer); |
373 | 373 | |
374 | 374 | // Assign any includes. |
@@ -426,11 +426,11 @@ discard block |
||
426 | 426 | // We use our configuration value 'transformer_namespace' to determine where to look. |
427 | 427 | try { |
428 | 428 | $transformerClass = sprintf('%s\\%sTransformer', |
429 | - $this->config['transformer_namespace'] ?? 'App\\Transformers', |
|
429 | + $this->config[ 'transformer_namespace' ] ?? 'App\\Transformers', |
|
430 | 430 | (new \ReflectionClass($model))->getShortName()); |
431 | 431 | $transformer = app()->make($transformerClass); |
432 | 432 | } catch (\Exception $e) { |
433 | - throw new UnresolvedTransformerException('Unable to resolve transformer for model: '.\get_class($model), 0, $e); |
|
433 | + throw new UnresolvedTransformerException('Unable to resolve transformer for model: ' . \get_class($model), 0, $e); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | return $transformer; |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | return $this->autoParseIncludes; |
468 | 468 | } |
469 | 469 | |
470 | - return $this->config['include_key'] ?? 'include'; |
|
470 | + return $this->config[ 'include_key' ] ?? 'include'; |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | /** |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | * |
508 | 508 | * @see Smokescreen::toArray() |
509 | 509 | */ |
510 | - public function response(int $statusCode = 200, array $headers = [], int $options = 0): JsonResponse |
|
510 | + public function response(int $statusCode = 200, array $headers = [ ], int $options = 0): JsonResponse |
|
511 | 511 | { |
512 | 512 | // Response will only be generated once. use clearResponse() to clear. |
513 | 513 | if ($this->response === null) { |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | * @see Smokescreen::toArray() |
536 | 536 | * @see Smokescreen::response() |
537 | 537 | */ |
538 | - public function freshResponse(int $statusCode = 200, array $headers = [], int $options = 0): JsonResponse |
|
538 | + public function freshResponse(int $statusCode = 200, array $headers = [ ], int $options = 0): JsonResponse |
|
539 | 539 | { |
540 | 540 | $this->clearResponse(); |
541 | 541 |