@@ -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->setConfig($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 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | } elseif ($data instanceof Builder) { |
| 225 | 225 | $data = $data->get(); |
| 226 | 226 | } elseif ($data instanceof Model) { |
| 227 | - $data = new Collection([$data]); |
|
| 227 | + $data = new Collection([ $data ]); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | // Create a new collection resource |
@@ -425,11 +425,11 @@ discard block |
||
| 425 | 425 | // We use our configuration value 'transformer_namespace' to determine where to look. |
| 426 | 426 | try { |
| 427 | 427 | $transformerClass = sprintf('%s\\%sTransformer', |
| 428 | - $this->config['transformer_namespace'] ?? 'App\\Transformers', |
|
| 428 | + $this->config[ 'transformer_namespace' ] ?? 'App\\Transformers', |
|
| 429 | 429 | (new \ReflectionClass($model))->getShortName()); |
| 430 | 430 | $transformer = app()->make($transformerClass); |
| 431 | 431 | } catch (\Exception $e) { |
| 432 | - throw new UnresolvedTransformerException('Unable to resolve transformer for model: '.\get_class($model), 0, $e); |
|
| 432 | + throw new UnresolvedTransformerException('Unable to resolve transformer for model: ' . \get_class($model), 0, $e); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | return $transformer; |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | return $this->autoParseIncludes; |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | - return $this->config['include_key'] ?? 'include'; |
|
| 469 | + return $this->config[ 'include_key' ] ?? 'include'; |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | /** |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | * |
| 507 | 507 | * @see Smokescreen::toArray() |
| 508 | 508 | */ |
| 509 | - public function response(int $statusCode = 200, array $headers = [], int $options = 0): JsonResponse |
|
| 509 | + public function response(int $statusCode = 200, array $headers = [ ], int $options = 0): JsonResponse |
|
| 510 | 510 | { |
| 511 | 511 | // Response will only be generated once. use clearResponse() to clear. |
| 512 | 512 | if ($this->response === null) { |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | * @see Smokescreen::toArray() |
| 535 | 535 | * @see Smokescreen::response() |
| 536 | 536 | */ |
| 537 | - public function freshResponse(int $statusCode = 200, array $headers = [], int $options = 0): JsonResponse |
|
| 537 | + public function freshResponse(int $statusCode = 200, array $headers = [ ], int $options = 0): JsonResponse |
|
| 538 | 538 | { |
| 539 | 539 | $this->clearResponse(); |
| 540 | 540 | |
@@ -651,15 +651,15 @@ discard block |
||
| 651 | 651 | */ |
| 652 | 652 | protected function setConfig(array $config) |
| 653 | 653 | { |
| 654 | - if (!empty($config['default_serializer'])) { |
|
| 655 | - $serializer = $config['default_serializer']; |
|
| 654 | + if (!empty($config[ 'default_serializer' ])) { |
|
| 655 | + $serializer = $config[ 'default_serializer' ]; |
|
| 656 | 656 | if (\is_string($serializer)) { |
| 657 | 657 | // Given serializer is expected to be a class path |
| 658 | 658 | // Instantiate via the container |
| 659 | 659 | $serializer = app()->make($serializer); |
| 660 | 660 | } |
| 661 | 661 | $this->serializeWith($serializer); |
| 662 | - unset($config['default_serializer']); |
|
| 662 | + unset($config[ 'default_serializer' ]); |
|
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | $this->config = $config; |