@@ -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. |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | $this->smokescreen->parseIncludes($this->includes); |
| 378 | 378 | } elseif ($this->autoParseIncludes) { |
| 379 | 379 | // If autoParseIncludes is not false, then try to parse from the request object. |
| 380 | - $this->smokescreen->parseIncludes((string)$this->request()->input($this->getIncludeKey())); |
|
| 380 | + $this->smokescreen->parseIncludes((string) $this->request()->input($this->getIncludeKey())); |
|
| 381 | 381 | } else { |
| 382 | 382 | // Empty includes |
| 383 | 383 | $this->smokescreen->parseIncludes(''); |
@@ -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 | |