@@ -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; |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | (new \ReflectionClass($model))->getShortName()); |
| 56 | 56 | $transformer = resolve($transformerClass); |
| 57 | 57 | } catch (\Exception $e) { |
| 58 | - throw new UnresolvedTransformerException('Unable to resolve transformer for model: '.\get_class($model), |
|
| 58 | + throw new UnresolvedTransformerException('Unable to resolve transformer for model: ' . \get_class($model), |
|
| 59 | 59 | 0, $e); |
| 60 | 60 | } |
| 61 | 61 | } |