Completed
Push — master ( a97e8a...2beeb5 )
by Alexander
03:01
created
src/Responder.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
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
      */
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     public function success( $data = null, int $statusCode = 200 ):JsonResponse
35 35
     {
36 36
         if ( is_integer( $data ) ) {
37
-            list( $statusCode, $data ) = [ $data, null ];
37
+            list($statusCode, $data) = [ $data, null ];
38 38
         }
39 39
 
40 40
         $resource = $this->transform( $data );
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             throw new InvalidArgumentException( 'Data must only contain models implementing the Transformable contract.' );
170 170
         }
171 171
 
172
-        $collection->each( function ( $model ) use ( $class ) {
172
+        $collection->each( function ( $model ) use ($class) {
173 173
             if ( get_class( $model ) !== get_class( $class ) ) {
174 174
                 throw new InvalidArgumentException( 'You cannot transform arrays or collections with multiple model types.' );
175 175
             }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
         if ( ! is_null( $data ) ) {
189 189
             $transformer = $model::transformer();
190
-            $includes = ( new $transformer( $model ) )->getAvailableIncludes();
190
+            $includes = (new $transformer( $model ))->getAvailableIncludes();
191 191
             $manager = $manager->parseIncludes( $includes );
192 192
         }
193 193
 
Please login to merge, or discard this patch.
Unused Use Statements   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,6 +2,9 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace Flugg\Responder;
4 4
 
5
+use Flugg\Responder\Contracts\Manager;
6
+use Flugg\Responder\Contracts\Responder as ResponderContract;
7
+use Flugg\Responder\Contracts\Transformable;
5 8
 use Illuminate\Contracts\Pagination\LengthAwarePaginator;
6 9
 use Illuminate\Http\JsonResponse;
7 10
 use Illuminate\Support\Collection;
@@ -11,9 +14,6 @@  discard block
 block discarded – undo
11 14
 use League\Fractal\Resource\Item as FractalItem;
12 15
 use League\Fractal\Resource\NullResource as FractalNull;
13 16
 use League\Fractal\Resource\ResourceInterface;
14
-use Flugg\Responder\Contracts\Manager;
15
-use Flugg\Responder\Contracts\Responder as ResponderContract;
16
-use Flugg\Responder\Contracts\Transformable;
17 17
 
18 18
 /**
19 19
  * The responder service. This class is responsible for generating JSON API responses.
Please login to merge, or discard this patch.
src/Traits/ConvertsToSnakeCase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
      */
70 70
     protected function castBooleans( $input ):array
71 71
     {
72
-        if ( isset( $this->convertToSnakeCase ) && ! $this->convertToSnakeCase ) {
72
+        if ( isset($this->convertToSnakeCase) && ! $this->convertToSnakeCase ) {
73 73
             return;
74 74
         }
75 75
 
Please login to merge, or discard this patch.
src/Transformer.php 1 patch
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@
 block discarded – undo
2 2
 
3 3
 namespace Flugg\Responder;
4 4
 
5
+use Flugg\Responder\Contracts\Transformable;
5 6
 use League\Fractal\Scope;
6 7
 use League\Fractal\TransformerAbstract;
7
-use Flugg\Responder\Contracts\Transformable;
8 8
 
9 9
 /**
10 10
  * An abstract base transformer. All transformers should extend this, and this class
Please login to merge, or discard this patch.