@@ -141,7 +141,7 @@ |
||
141 | 141 | * Transform the data using the given transformer. |
142 | 142 | * |
143 | 143 | * @param Transformable|Collection $data |
144 | - * @param Transformer|null $transformer |
|
144 | + * @param Transformer $transformer |
|
145 | 145 | * @param string $resourceKey |
146 | 146 | * @return ResourceInterface |
147 | 147 | */ |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | public function success( $data = null, $statusCode = 200, $meta = null ):JsonResponse |
38 | 38 | { |
39 | 39 | if ( is_integer( $data ) ) { |
40 | - list( $data, $statusCode, $meta ) = [ null, $data, $statusCode ]; |
|
40 | + list($data, $statusCode, $meta) = [ null, $data, $statusCode ]; |
|
41 | 41 | } elseif ( is_array( $statusCode ) ) { |
42 | - list( $statusCode, $meta ) = [ 200, $statusCode ]; |
|
42 | + list($statusCode, $meta) = [ 200, $statusCode ]; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $resource = $this->transform( $data ); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | if ( ! is_null( $data ) ) { |
117 | 117 | $transformer = $model::transformer(); |
118 | - $includes = is_string( $transformer ) ? ( new $transformer( $model ) )->getAvailableIncludes() : [ ]; |
|
118 | + $includes = is_string( $transformer ) ? (new $transformer( $model ))->getAvailableIncludes() : [ ]; |
|
119 | 119 | $manager = $manager->parseIncludes( $includes ); |
120 | 120 | } |
121 | 121 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $transformer = $transformer ?: $model::transformer(); |
135 | 135 | |
136 | 136 | if ( is_null( $transformer ) ) { |
137 | - return new FractalItem( $model, function () use ( $model ) { |
|
137 | + return new FractalItem( $model, function () use ($model) { |
|
138 | 138 | return $model->toArray(); |
139 | 139 | } ); |
140 | 140 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $transformer = $transformer ?: $model::transformer(); |
156 | 156 | |
157 | 157 | if ( is_null( $transformer ) ) { |
158 | - return new FractalCollection( $collection, function () use ( $collection ) { |
|
158 | + return new FractalCollection( $collection, function () use ($collection) { |
|
159 | 159 | return $collection->toArray(); |
160 | 160 | } ); |
161 | 161 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | throw new InvalidArgumentException( 'Data must only contain models implementing the Transformable contract.' ); |
211 | 211 | } |
212 | 212 | |
213 | - $collection->each( function ( $model ) use ( $class ) { |
|
213 | + $collection->each( function ( $model ) use ($class) { |
|
214 | 214 | if ( get_class( $model ) !== get_class( $class ) ) { |
215 | 215 | throw new InvalidArgumentException( 'You cannot transform arrays or collections with multiple model types.' ); |
216 | 216 | } |