@@ -26,8 +26,8 @@ |
||
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 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param \Rexlabs\Smokescreen\Smokescreen $smokescreen |
73 | 73 | * @param array $config |
74 | 74 | */ |
75 | - public function __construct(\Rexlabs\Smokescreen\Smokescreen $smokescreen, array $config = []) |
|
75 | + public function __construct(\Rexlabs\Smokescreen\Smokescreen $smokescreen, array $config = [ ]) |
|
76 | 76 | { |
77 | 77 | $this->smokescreen = $smokescreen; |
78 | 78 | $this->config = $config; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return static |
88 | 88 | */ |
89 | - public static function make(\Rexlabs\Smokescreen\Smokescreen $smokescreen = null, array $config = []) |
|
89 | + public static function make(\Rexlabs\Smokescreen\Smokescreen $smokescreen = null, array $config = [ ]) |
|
90 | 90 | { |
91 | 91 | return new static($smokescreen ?? new \Rexlabs\Smokescreen\Smokescreen(), $config); |
92 | 92 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | } elseif ($data instanceof Builder) { |
222 | 222 | $data = $data->get(); |
223 | 223 | } elseif ($data instanceof Model) { |
224 | - $data = new Collection([$data]); |
|
224 | + $data = new Collection([ $data ]); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // Create a new collection resource |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | |
353 | 353 | // Serializer may be overridden via config |
354 | 354 | // We may be setting the serializer to null, in which case a default will be provided. |
355 | - $serializer = $this->serializer ?? $this->config['default_serializer'] ?? null; |
|
355 | + $serializer = $this->serializer ?? $this->config[ 'default_serializer' ] ?? null; |
|
356 | 356 | $this->smokescreen->setSerializer($serializer); |
357 | 357 | |
358 | 358 | // Assign any includes. |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | // We use our configuration value 'transformer_namespace' to determine where to look. |
410 | 410 | try { |
411 | 411 | $transformerClass = sprintf('%s\\%sTransformer', |
412 | - $this->config['transformer_namespace'] ?? 'App\\Transformers', |
|
412 | + $this->config[ 'transformer_namespace' ] ?? 'App\\Transformers', |
|
413 | 413 | (new \ReflectionClass($model))->getShortName()); |
414 | 414 | $transformer = app()->make($transformerClass); |
415 | 415 | } catch (\Exception $e) { |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | return $this->autoParseIncludes; |
449 | 449 | } |
450 | 450 | |
451 | - return $this->config['include_key'] ?? 'include'; |
|
451 | + return $this->config[ 'include_key' ] ?? 'include'; |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | /** |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @throws \Rexlabs\Smokescreen\Exception\MissingResourceException |
486 | 486 | * @see Smokescreen::toArray() |
487 | 487 | */ |
488 | - public function response(int $statusCode = 200, array $headers = [], int $options = 0): JsonResponse |
|
488 | + public function response(int $statusCode = 200, array $headers = [ ], int $options = 0): JsonResponse |
|
489 | 489 | { |
490 | 490 | // Response will only be generated once. use clearResponse() to clear. |
491 | 491 | if ($this->response === null) { |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * @see Smokescreen::toArray() |
513 | 513 | * @see Smokescreen::response() |
514 | 514 | */ |
515 | - public function freshResponse(int $statusCode = 200, array $headers = [], int $options = 0): JsonResponse |
|
515 | + public function freshResponse(int $statusCode = 200, array $headers = [ ], int $options = 0): JsonResponse |
|
516 | 516 | { |
517 | 517 | $this->clearResponse(); |
518 | 518 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | */ |
556 | 556 | public function include($includes) |
557 | 557 | { |
558 | - $this->includes = $includes === null ? $includes : (string)$includes; |
|
558 | + $this->includes = $includes === null ? $includes : (string) $includes; |
|
559 | 559 | |
560 | 560 | return $this; |
561 | 561 | } |
@@ -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); |