Completed
Push — master ( 9f9361...de31e6 )
by Alexander
03:49
created
src/ResponderServiceProvider.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -43,18 +43,18 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function boot()
45 45
     {
46
-        if ($this->app instanceof Laravel && $this->app->runningInConsole()) {
46
+        if ( $this->app instanceof Laravel && $this->app->runningInConsole() ) {
47 47
             $this->bootLaravelApplication();
48 48
 
49
-        } elseif ($this->app instanceof Lumen) {
49
+        } elseif ( $this->app instanceof Lumen ) {
50 50
             $this->bootLumenApplication();
51 51
         }
52 52
 
53
-        $this->mergeConfigFrom(__DIR__ . '/../resources/config/responder.php', 'responder');
53
+        $this->mergeConfigFrom( __DIR__ . '/../resources/config/responder.php', 'responder' );
54 54
 
55
-        $this->commands([
55
+        $this->commands( [
56 56
             MakeTransformer::class
57
-        ]);
57
+        ] );
58 58
 
59 59
         include __DIR__ . '/helpers.php';
60 60
     }
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
         $this->registerFractal();
70 70
         $this->registerResponseBuilders();
71 71
 
72
-        $this->app->bind(Responder::class, function ($app) {
73
-            return new Responder($app[SuccessResponseBuilder::class], $app[ErrorResponseBuilder::class]);
72
+        $this->app->bind( Responder::class, function ( $app ) {
73
+            return new Responder( $app[ SuccessResponseBuilder::class ], $app[ ErrorResponseBuilder::class ] );
74 74
         });
75 75
 
76 76
         $this->registerAliases();
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function provides()
85 85
     {
86
-        return ['responder', 'responder.success', 'responder.error', 'responder.manager', 'responder.serializer'];
86
+        return [ 'responder', 'responder.success', 'responder.error', 'responder.manager', 'responder.serializer' ];
87 87
     }
88 88
 
89 89
     /**
@@ -94,17 +94,17 @@  discard block
 block discarded – undo
94 94
      */
95 95
     protected function registerFractal()
96 96
     {
97
-        $this->app->bind(SerializerAbstract::class, function ($app) {
98
-            $serializer = $app->config->get('responder.serializer');
97
+        $this->app->bind( SerializerAbstract::class, function ( $app ) {
98
+            $serializer = $app->config->get( 'responder.serializer' );
99 99
 
100 100
             return new $serializer;
101 101
         });
102 102
 
103
-        $this->app->bind(Manager::class, function ($app) {
104
-            return (new Manager())->setSerializer($app[SerializerAbstract::class]);
103
+        $this->app->bind( Manager::class, function ( $app ) {
104
+            return (new Manager())->setSerializer( $app[ SerializerAbstract::class ] );
105 105
         });
106 106
 
107
-        $this->app->bind(ResourceFactory::class, function () {
107
+        $this->app->bind( ResourceFactory::class, function () {
108 108
             return new ResourceFactory();
109 109
         });
110 110
     }
@@ -116,20 +116,20 @@  discard block
 block discarded – undo
116 116
      */
117 117
     protected function registerResponseBuilders()
118 118
     {
119
-        $this->app->bind(SuccessResponseBuilder::class, function ($app) {
120
-            $builder = new SuccessResponseBuilder(response(), $app[ResourceFactory::class], $app[Manager::class]);
119
+        $this->app->bind( SuccessResponseBuilder::class, function ( $app ) {
120
+            $builder = new SuccessResponseBuilder( response(), $app[ ResourceFactory::class ], $app[ Manager::class ] );
121 121
 
122
-            if ($parameter = $app->config->get('responder.load_relations_from_parameter')) {
123
-                $builder->include($this->app[Request::class]->input($parameter, []));
122
+            if ( $parameter = $app->config->get( 'responder.load_relations_from_parameter' ) ) {
123
+                $builder->include( $this->app[ Request::class ]->input( $parameter, [ ] ) );
124 124
             }
125 125
 
126
-            return $builder->setIncludeStatusCode($app->config->get('responder.include_status_code'));
126
+            return $builder->setIncludeStatusCode( $app->config->get( 'responder.include_status_code' ) );
127 127
         });
128 128
 
129
-        $this->app->bind(ErrorResponseBuilder::class, function ($app) {
130
-            $builder = new ErrorResponseBuilder(response(), $app['translator']);
129
+        $this->app->bind( ErrorResponseBuilder::class, function ( $app ) {
130
+            $builder = new ErrorResponseBuilder( response(), $app[ 'translator' ] );
131 131
 
132
-            return $builder->setIncludeStatusCode($app->config->get('responder.include_status_code'));
132
+            return $builder->setIncludeStatusCode( $app->config->get( 'responder.include_status_code' ) );
133 133
         });
134 134
     }
135 135
 
@@ -140,11 +140,11 @@  discard block
 block discarded – undo
140 140
      */
141 141
     protected function registerAliases()
142 142
     {
143
-        $this->app->alias(Responder::class, 'responder');
144
-        $this->app->alias(SuccessResponseBuilder::class, 'responder.success');
145
-        $this->app->alias(ErrorResponseBuilder::class, 'responder.error');
146
-        $this->app->alias(Manager::class, 'responder.manager');
147
-        $this->app->alias(Manager::class, 'responder.serializer');
143
+        $this->app->alias( Responder::class, 'responder' );
144
+        $this->app->alias( SuccessResponseBuilder::class, 'responder.success' );
145
+        $this->app->alias( ErrorResponseBuilder::class, 'responder.error' );
146
+        $this->app->alias( Manager::class, 'responder.manager' );
147
+        $this->app->alias( Manager::class, 'responder.serializer' );
148 148
     }
149 149
 
150 150
     /**
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
      */
155 155
     protected function bootLaravelApplication()
156 156
     {
157
-        $this->publishes([
158
-            __DIR__ . '/../resources/config/responder.php' => config_path('responder.php')
159
-        ], 'config');
157
+        $this->publishes( [
158
+            __DIR__ . '/../resources/config/responder.php' => config_path( 'responder.php' )
159
+        ], 'config' );
160 160
 
161
-        $this->publishes([
162
-            __DIR__ . '/../resources/lang/en/errors.php' => app_path('resources/lang/en/errors.php')
163
-        ], 'lang');
161
+        $this->publishes( [
162
+            __DIR__ . '/../resources/lang/en/errors.php' => app_path( 'resources/lang/en/errors.php' )
163
+        ], 'lang' );
164 164
     }
165 165
 
166 166
     /**
@@ -170,6 +170,6 @@  discard block
 block discarded – undo
170 170
      */
171 171
     protected function bootLumenApplication()
172 172
     {
173
-        $this->app->configure('responder');
173
+        $this->app->configure( 'responder' );
174 174
     }
175 175
 }
176 176
\ No newline at end of file
Please login to merge, or discard this patch.
src/Http/SuccessResponseBuilder.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
      *
38 38
      * @var array
39 39
      */
40
-    protected $meta = [];
40
+    protected $meta = [ ];
41 41
 
42 42
     /**
43 43
      * The included relations.
44 44
      *
45 45
      * @var array
46 46
      */
47
-    protected $relations = [];
47
+    protected $relations = [ ];
48 48
 
49 49
     /**
50 50
      * The Fractal resource instance containing the data and transformer.
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
      * @param \Flugg\Responder\ResourceFactory                                                  $resourceFactory
75 75
      * @param \League\Fractal\Manager                                                           $manager
76 76
      */
77
-    public function __construct($responseFactory, ResourceFactory $resourceFactory, Manager $manager)
77
+    public function __construct( $responseFactory, ResourceFactory $resourceFactory, Manager $manager )
78 78
     {
79 79
         $this->resourceFactory = $resourceFactory;
80 80
         $this->manager = $manager;
81 81
         $this->resource = $this->resourceFactory->make();
82 82
 
83
-        parent::__construct($responseFactory);
83
+        parent::__construct( $responseFactory );
84 84
     }
85 85
 
86 86
     /**
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
      * @param  array $data
90 90
      * @return self
91 91
      */
92
-    public function addMeta(array $data):SuccessResponseBuilder
92
+    public function addMeta( array $data ):SuccessResponseBuilder
93 93
     {
94
-        $this->meta = array_merge($this->meta, $data);
94
+        $this->meta = array_merge( $this->meta, $data );
95 95
 
96 96
         return $this;
97 97
     }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function include($relations):SuccessResponseBuilder
106 106
     {
107
-        $this->relations = array_merge($this->relations, (array) $relations);
107
+        $this->relations = array_merge( $this->relations, (array) $relations );
108 108
 
109 109
         return $this;
110 110
     }
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
      * @param  \League\Fractal\Serializer\SerializerAbstract|string $serializer
116 116
      * @return self
117 117
      */
118
-    public function serializer($serializer):SuccessResponseBuilder
118
+    public function serializer( $serializer ):SuccessResponseBuilder
119 119
     {
120
-        $this->manager->setSerializer($this->resolveSerializer($serializer));
120
+        $this->manager->setSerializer( $this->resolveSerializer( $serializer ) );
121 121
 
122 122
         return $this;
123 123
     }
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
      * @return self
130 130
      * @throws \InvalidArgumentException
131 131
      */
132
-    public function setStatus(int $statusCode):ResponseBuilder
132
+    public function setStatus( int $statusCode ):ResponseBuilder
133 133
     {
134
-        if ($statusCode < 100 || $statusCode >= 400) {
135
-            throw new InvalidArgumentException("{$statusCode} is not a valid success HTTP status code.");
134
+        if ( $statusCode < 100 || $statusCode >= 400 ) {
135
+            throw new InvalidArgumentException( "{$statusCode} is not a valid success HTTP status code." );
136 136
         }
137 137
 
138
-        return parent::setStatus($statusCode);
138
+        return parent::setStatus( $statusCode );
139 139
     }
140 140
 
141 141
     /**
@@ -147,25 +147,25 @@  discard block
 block discarded – undo
147 147
      * @param  string|null          $resourceKey
148 148
      * @return self
149 149
      */
150
-    public function transform($data = null, $transformer = null, string $resourceKey = null):SuccessResponseBuilder
150
+    public function transform( $data = null, $transformer = null, string $resourceKey = null ):SuccessResponseBuilder
151 151
     {
152
-        $resource = $this->resourceFactory->make($data);
152
+        $resource = $this->resourceFactory->make( $data );
153 153
 
154
-        if (! is_null($resource->getData())) {
155
-            $model = $this->resolveModel($resource->getData());
156
-            $transformer = $this->resolveTransformer($model, $transformer);
157
-            $resourceKey = $this->resolveResourceKey($model, $resourceKey);
154
+        if ( ! is_null( $resource->getData() ) ) {
155
+            $model = $this->resolveModel( $resource->getData() );
156
+            $transformer = $this->resolveTransformer( $model, $transformer );
157
+            $resourceKey = $this->resolveResourceKey( $model, $resourceKey );
158 158
         }
159 159
 
160
-        if ($transformer instanceof Transformer) {
161
-            $this->include($relations = $this->resolveNestedRelations($resource->getData()));
160
+        if ( $transformer instanceof Transformer ) {
161
+            $this->include( $relations = $this->resolveNestedRelations( $resource->getData() ) );
162 162
 
163
-            if ($transformer->allRelationsAllowed()) {
164
-                $transformer->setRelations($relations);
163
+            if ( $transformer->allRelationsAllowed() ) {
164
+                $transformer->setRelations( $relations );
165 165
             }
166 166
         }
167 167
 
168
-        $this->resource = $resource->setTransformer($transformer)->setResourceKey($resourceKey);
168
+        $this->resource = $resource->setTransformer( $transformer )->setResourceKey( $resourceKey );
169 169
 
170 170
         return $this;
171 171
     }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function toArray():array
179 179
     {
180
-        return $this->serialize($this->getResource());
180
+        return $this->serialize( $this->getResource() );
181 181
     }
182 182
 
183 183
     /**
@@ -187,14 +187,14 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function getResource():ResourceInterface
189 189
     {
190
-        $this->manager->parseIncludes($this->relations);
190
+        $this->manager->parseIncludes( $this->relations );
191 191
         $transformer = $this->resource->getTransformer();
192 192
 
193
-        if ($transformer instanceof Transformer && $transformer->allRelationsAllowed()) {
194
-            $this->resource->setTransformer($transformer->setRelations($this->manager->getRequestedIncludes()));
193
+        if ( $transformer instanceof Transformer && $transformer->allRelationsAllowed() ) {
194
+            $this->resource->setTransformer( $transformer->setRelations( $this->manager->getRequestedIncludes() ) );
195 195
         }
196 196
 
197
-        return $this->resource->setMeta($this->meta);
197
+        return $this->resource->setMeta( $this->meta );
198 198
     }
199 199
 
200 200
     /**
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
      * @return \League\Fractal\Serializer\SerializerAbstract
215 215
      * @throws \Flugg\Responder\Exceptions\InvalidSerializerException
216 216
      */
217
-    protected function resolveSerializer($serializer):SerializerAbstract
217
+    protected function resolveSerializer( $serializer ):SerializerAbstract
218 218
     {
219
-        if (is_string($serializer)) {
219
+        if ( is_string( $serializer ) ) {
220 220
             $serializer = new $serializer;
221 221
         }
222 222
 
223
-        if (! $serializer instanceof SerializerAbstract) {
223
+        if ( ! $serializer instanceof SerializerAbstract ) {
224 224
             throw new InvalidSerializerException();
225 225
         }
226 226
 
@@ -234,15 +234,15 @@  discard block
 block discarded – undo
234 234
      * @return \Illuminate\Database\Eloquent\Model
235 235
      * @throws \InvalidArgumentException
236 236
      */
237
-    protected function resolveModel($data):Model
237
+    protected function resolveModel( $data ):Model
238 238
     {
239
-        if ($data instanceof Model) {
239
+        if ( $data instanceof Model ) {
240 240
             return $data;
241 241
         }
242 242
 
243
-        $model = array_values($data)[0];
244
-        if (! $model instanceof Model) {
245
-            throw new InvalidArgumentException('You can only transform data containing Eloquent models.');
243
+        $model = array_values( $data )[ 0 ];
244
+        if ( ! $model instanceof Model ) {
245
+            throw new InvalidArgumentException( 'You can only transform data containing Eloquent models.' );
246 246
         }
247 247
 
248 248
         return $model;
@@ -255,15 +255,15 @@  discard block
 block discarded – undo
255 255
      * @param  \Flugg\Responder\Transformer|callable|null $transformer
256 256
      * @return \Flugg\Responder\Transformer|callable
257 257
      */
258
-    protected function resolveTransformer(Model $model, $transformer = null)
258
+    protected function resolveTransformer( Model $model, $transformer = null )
259 259
     {
260
-        $transformer = $transformer ?: $this->resolveTransformerFromModel($model);
260
+        $transformer = $transformer ?: $this->resolveTransformerFromModel( $model );
261 261
 
262
-        if (is_string($transformer)) {
262
+        if ( is_string( $transformer ) ) {
263 263
             $transformer = new $transformer;
264 264
         }
265 265
 
266
-        return $this->parseTransformer($transformer, $model);
266
+        return $this->parseTransformer( $transformer, $model );
267 267
     }
268 268
 
269 269
     /**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
      * @param  \Illuminate\Database\ELoquent\Model $model
274 274
      * @return \Flugg\Responder\Transformer|callable
275 275
      */
276
-    protected function resolveTransformerFromModel(Model $model)
276
+    protected function resolveTransformerFromModel( Model $model )
277 277
     {
278
-        if (! $model instanceof Transformable) {
279
-            return function ($model) {
278
+        if ( ! $model instanceof Transformable ) {
279
+            return function ( $model ) {
280 280
                 return $model->toArray();
281 281
             };
282 282
         }
@@ -292,14 +292,14 @@  discard block
 block discarded – undo
292 292
      * @return \Flugg\Responder\Transformer|callable
293 293
      * @throws \InvalidTransformerException
294 294
      */
295
-    protected function parseTransformer($transformer, Model $model)
295
+    protected function parseTransformer( $transformer, Model $model )
296 296
     {
297
-        if ($transformer instanceof Transformer) {
298
-            $relations = $transformer->allRelationsAllowed() ? $this->resolveRelations($model) : $transformer->getRelations();
299
-            $transformer = $transformer->setRelations($relations);
297
+        if ( $transformer instanceof Transformer ) {
298
+            $relations = $transformer->allRelationsAllowed() ? $this->resolveRelations( $model ) : $transformer->getRelations();
299
+            $transformer = $transformer->setRelations( $relations );
300 300
 
301
-        } elseif (! is_callable($transformer)) {
302
-            throw new InvalidTransformerException($model);
301
+        } elseif ( ! is_callable( $transformer ) ) {
302
+            throw new InvalidTransformerException( $model );
303 303
         }
304 304
 
305 305
         return $transformer;
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
      * @param  \Illuminate\Database\Eloquent\Model $model
312 312
      * @return array
313 313
      */
314
-    protected function resolveRelations(Model $model):array
314
+    protected function resolveRelations( Model $model ):array
315 315
     {
316
-        return array_keys($model->getRelations());
316
+        return array_keys( $model->getRelations() );
317 317
     }
318 318
 
319 319
     /**
@@ -322,22 +322,22 @@  discard block
 block discarded – undo
322 322
      * @param  \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model $data
323 323
      * @return array
324 324
      */
325
-    protected function resolveNestedRelations($data):array
325
+    protected function resolveNestedRelations( $data ):array
326 326
     {
327
-        if (is_null($data)) {
328
-            return [];
327
+        if ( is_null( $data ) ) {
328
+            return [ ];
329 329
         }
330 330
 
331
-        $data = $data instanceof Model ? [$data] : $data;
331
+        $data = $data instanceof Model ? [ $data ] : $data;
332 332
 
333
-        return collect($data)->flatMap(function ($model) {
334
-            $relations = collect($model->getRelations());
333
+        return collect( $data )->flatMap( function ( $model ) {
334
+            $relations = collect( $model->getRelations() );
335 335
 
336
-            return $relations->keys()->merge($relations->flatMap(function ($relation, $key) {
337
-                return collect($this->resolveNestedRelations($relation))->map(function ($nestedRelation) use ($key) {
336
+            return $relations->keys()->merge( $relations->flatMap( function ( $relation, $key ) {
337
+                return collect( $this->resolveNestedRelations( $relation ) )->map( function ( $nestedRelation ) use ($key) {
338 338
                     return $key . '.' . $nestedRelation;
339 339
                 });
340
-            }));
340
+            }) );
341 341
         })->toArray();
342 342
     }
343 343
 
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
      * @param  string|null                         $resourceKey
349 349
      * @return string
350 350
      */
351
-    protected function resolveResourceKey(Model $model, string $resourceKey = null):string
351
+    protected function resolveResourceKey( Model $model, string $resourceKey = null ):string
352 352
     {
353
-        if (! is_null($resourceKey)) {
353
+        if ( ! is_null( $resourceKey ) ) {
354 354
             return $resourceKey;
355 355
         }
356 356
 
357
-        if (method_exists($model, 'getResourceKey')) {
357
+        if ( method_exists( $model, 'getResourceKey' ) ) {
358 358
             return $model->getResourceKey();
359 359
         }
360 360
 
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
      * @param  ResourceInterface $resource
368 368
      * @return array
369 369
      */
370
-    protected function serialize(ResourceInterface $resource):array
370
+    protected function serialize( ResourceInterface $resource ):array
371 371
     {
372
-        return $this->manager->createData($resource)->toArray();
372
+        return $this->manager->createData( $resource )->toArray();
373 373
     }
374 374
 }
375 375
\ No newline at end of file
Please login to merge, or discard this patch.
src/Transformer.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      *
23 23
      * @var array
24 24
      */
25
-    protected $relations = ['*'];
25
+    protected $relations = [ '*' ];
26 26
 
27 27
     /**
28 28
      * Get relations set on the transformer.
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function getRelations():array
33 33
     {
34
-        $relations = array_unique(array_merge($this->getAvailableIncludes(), $this->relations));
34
+        $relations = array_unique( array_merge( $this->getAvailableIncludes(), $this->relations ) );
35 35
 
36
-        return array_filter($relations, function($relation) {
36
+        return array_filter( $relations, function ( $relation ) {
37 37
             return $relation !== '*';
38 38
         });
39 39
     }
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
      * @param  array|string $relations
45 45
      * @return self
46 46
      */
47
-    public function setRelations($relations)
47
+    public function setRelations( $relations )
48 48
     {
49
-        $this->setAvailableIncludes(array_merge($this->availableIncludes, (array) $relations));
49
+        $this->setAvailableIncludes( array_merge( $this->availableIncludes, (array) $relations ) );
50 50
 
51 51
         return $this;
52 52
     }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function allRelationsAllowed():bool
60 60
     {
61
-        return $this->relations == ['*'];
61
+        return $this->relations == [ '*' ];
62 62
     }
63 63
 
64 64
     /**
@@ -71,24 +71,24 @@  discard block
 block discarded – undo
71 71
      * @return \League\Fractal\Resource\ResourceInterface|bool
72 72
      * @throws \Exception
73 73
      */
74
-    protected function callIncludeMethod(Scope $scope, $includeName, $data)
74
+    protected function callIncludeMethod( Scope $scope, $includeName, $data )
75 75
     {
76
-        if ($includeName === 'pivot') {
77
-            return $this->includePivot($data->$includeName);
76
+        if ( $includeName === 'pivot' ) {
77
+            return $this->includePivot( $data->$includeName );
78 78
         }
79 79
 
80
-        $params = $scope->getManager()->getIncludeParams($scope->getIdentifier($includeName));
80
+        $params = $scope->getManager()->getIncludeParams( $scope->getIdentifier( $includeName ) );
81 81
 
82
-        if (method_exists($this, $includeName)) {
83
-            $include = call_user_func([$this, $includeName], $data, $params);
82
+        if ( method_exists( $this, $includeName ) ) {
83
+            $include = call_user_func( [ $this, $includeName ], $data, $params );
84 84
 
85
-            if ($include instanceof ResourceAbstract) {
85
+            if ( $include instanceof ResourceAbstract ) {
86 86
                 return $include;
87 87
             }
88 88
 
89
-            return app(Responder::class)->transform($include)->getResource();
89
+            return app( Responder::class )->transform( $include )->getResource();
90 90
         } else {
91
-            return app(Responder::class)->transform($data->$includeName)->getResource();
91
+            return app( Responder::class )->transform( $data->$includeName )->getResource();
92 92
         }
93 93
     }
94 94
 
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
      * @param  Pivot $pivot
99 99
      * @return \League\Fractal\Resource\ResourceInterface|bool
100 100
      */
101
-    protected function includePivot(Pivot $pivot)
101
+    protected function includePivot( Pivot $pivot )
102 102
     {
103
-        if (! method_exists($this, 'transformPivot')) {
103
+        if ( ! method_exists( $this, 'transformPivot' ) ) {
104 104
             return false;
105 105
         }
106 106
 
107
-        return app(Responder::class)->transform($pivot, function ($pivot) {
108
-            return $this->transformPivot($pivot);
107
+        return app( Responder::class )->transform( $pivot, function ( $pivot ) {
108
+            return $this->transformPivot( $pivot );
109 109
         })->getResource();
110 110
     }
111 111
 }
112 112
\ No newline at end of file
Please login to merge, or discard this patch.