@@ -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 | */ |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | public function success( $data = null, $statusCode = 200, $meta = null ):JsonResponse |
37 | 37 | { |
38 | 38 | if ( is_integer( $data ) ) { |
39 | - list( $data, $statusCode, $meta ) = [ null, $data, $statusCode ]; |
|
39 | + list($data, $statusCode, $meta) = [ null, $data, $statusCode ]; |
|
40 | 40 | } elseif ( is_array( $statusCode ) ) { |
41 | - list( $statusCode, $meta ) = [ 200, $statusCode ]; |
|
41 | + list($statusCode, $meta) = [ 200, $statusCode ]; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $resource = $this->transform( $data ); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | if ( ! is_null( $data ) ) { |
116 | 116 | $transformer = $model::transformer(); |
117 | - $includes = ( new $transformer( $model ) )->getAvailableIncludes(); |
|
117 | + $includes = (new $transformer( $model ))->getAvailableIncludes(); |
|
118 | 118 | $manager = $manager->parseIncludes( $includes ); |
119 | 119 | } |
120 | 120 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | throw new InvalidArgumentException( 'Data must only contain models implementing the Transformable contract.' ); |
206 | 206 | } |
207 | 207 | |
208 | - $collection->each( function ( $model ) use ( $class ) { |
|
208 | + $collection->each( function ( $model ) use ($class) { |
|
209 | 209 | if ( get_class( $model ) !== get_class( $class ) ) { |
210 | 210 | throw new InvalidArgumentException( 'You cannot transform arrays or collections with multiple model types.' ); |
211 | 211 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | } ); |
67 | 67 | |
68 | 68 | $this->app->singleton( ManagerContract::class, function () { |
69 | - return ( new Manager() )->setSerializer( new $this->config[ 'serializer' ] ); |
|
69 | + return (new Manager())->setSerializer( new $this->config[ 'serializer' ] ); |
|
70 | 70 | } ); |
71 | 71 | |
72 | 72 | include __DIR__ . '/helpers.php'; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | protected function castToBooleanIsDisabled():bool |
130 | 130 | { |
131 | - return isset( $this->castBooleans ) && ! $this->castBooleans; |
|
131 | + return isset($this->castBooleans) && ! $this->castBooleans; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function convertToSnakeCaseIsDisabled():bool |
140 | 140 | { |
141 | - return isset( $this->convertToSnakeCase ) && ! $this->convertToSnakeCase; |
|
141 | + return isset($this->convertToSnakeCase) && ! $this->convertToSnakeCase; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -103,7 +103,6 @@ |
||
103 | 103 | /** |
104 | 104 | * Decodes JSON response and returns the data. |
105 | 105 | * |
106 | - * @param string|array $field |
|
107 | 106 | * @return array |
108 | 107 | */ |
109 | 108 | protected function getSuccessData( $attributes = null ) |
@@ -119,7 +119,7 @@ |
||
119 | 119 | $data = [ ]; |
120 | 120 | |
121 | 121 | foreach ( $attributes as $attribute ) { |
122 | - $data[] = array_get( $rawData, $attribute ); |
|
122 | + $data[ ] = array_get( $rawData, $attribute ); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return $data; |