Completed
Pull Request — master (#26)
by Brian
03:13
created
src/Console/MakeTransformer.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @param  Filesystem $files
45 45
      */
46
-    public function __construct(Filesystem $files)
46
+    public function __construct( Filesystem $files )
47 47
     {
48 48
         parent::__construct();
49 49
 
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
      */
68 68
     protected function generateTransformer()
69 69
     {
70
-        $name = (string) $this->argument('name');
70
+        $name = (string) $this->argument( 'name' );
71 71
         $path = $this->laravel->basePath() . '/app/Transformers/' . $name . '.php';
72 72
 
73
-        if ($this->files->exists($path)) {
74
-            return $this->error($name . ' already exists!');
73
+        if ( $this->files->exists( $path ) ) {
74
+            return $this->error( $name . ' already exists!' );
75 75
         }
76 76
 
77
-        $this->makeDirectory($path);
77
+        $this->makeDirectory( $path );
78 78
 
79
-        $stubPath = $this->option('pivot') ? 'resources/stubs/transformer.pivot.stub' : 'resources/stubs/transformer.stub';
80
-        $stub = $this->files->get(__DIR__ . '/../../' . $stubPath);
79
+        $stubPath = $this->option( 'pivot' ) ? 'resources/stubs/transformer.pivot.stub' : 'resources/stubs/transformer.stub';
80
+        $stub = $this->files->get( __DIR__ . '/../../' . $stubPath );
81 81
 
82
-        $this->files->put($path, $this->makeTransformer($name, $stub));
82
+        $this->files->put( $path, $this->makeTransformer( $name, $stub ) );
83 83
 
84
-        $this->info('Transformer created successfully.');
84
+        $this->info( 'Transformer created successfully.' );
85 85
     }
86 86
 
87 87
     /**
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
      * @param  string $path
91 91
      * @return void
92 92
      */
93
-    protected function makeDirectory(string $path)
93
+    protected function makeDirectory( string $path )
94 94
     {
95
-        if (! $this->files->isDirectory(dirname($path))) {
96
-            $this->files->makeDirectory(dirname($path), 0777, true, true);
95
+        if ( ! $this->files->isDirectory( dirname( $path ) ) ) {
96
+            $this->files->makeDirectory( dirname( $path ), 0777, true, true );
97 97
         }
98 98
     }
99 99
 
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
      * @param  string $stub
105 105
      * @return string
106 106
      */
107
-    protected function makeTransformer(string $name, string $stub):string
107
+    protected function makeTransformer( string $name, string $stub ):string
108 108
     {
109
-        $stub = $this->replaceNamespace($stub);
110
-        $stub = $this->replaceClass($stub, $name);
111
-        $stub = $this->replaceModel($stub, $name);
109
+        $stub = $this->replaceNamespace( $stub );
110
+        $stub = $this->replaceClass( $stub, $name );
111
+        $stub = $this->replaceModel( $stub, $name );
112 112
 
113 113
         return $stub;
114 114
     }
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
      * @param  string $stub
120 120
      * @return string
121 121
      */
122
-    protected function replaceNamespace(string $stub):string
122
+    protected function replaceNamespace( string $stub ):string
123 123
     {
124
-        if (method_exists($this->laravel, 'getNameSpace')) {
124
+        if ( method_exists( $this->laravel, 'getNameSpace' ) ) {
125 125
             $namespace = $this->laravel->getNamespace() . 'Transformers';
126 126
         } else {
127 127
             $namespace = 'App\Transformers';
128 128
         }
129 129
 
130
-        $stub = str_replace('DummyNamespace', $namespace, $stub);
130
+        $stub = str_replace( 'DummyNamespace', $namespace, $stub );
131 131
 
132 132
         return $stub;
133 133
     }
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
      * @param  string $name
140 140
      * @return string
141 141
      */
142
-    protected function replaceClass(string $stub, string $name):string
142
+    protected function replaceClass( string $stub, string $name ):string
143 143
     {
144
-        $stub = str_replace('DummyClass', $name, $stub);
144
+        $stub = str_replace( 'DummyClass', $name, $stub );
145 145
 
146 146
         return $stub;
147 147
     }
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
      * @param  string $name
154 154
      * @return string
155 155
      */
156
-    protected function replaceModel(string $stub, string $name):string
156
+    protected function replaceModel( string $stub, string $name ):string
157 157
     {
158
-        $model = $this->getModelNamespace($name);
159
-        $class = $this->getClassFromNamespace($model);
158
+        $model = $this->getModelNamespace( $name );
159
+        $class = $this->getClassFromNamespace( $model );
160 160
 
161
-        $stub = str_replace('DummyModelNamespace', $model, $stub);
162
-        $stub = str_replace('DummyModelClass', $class, $stub);
163
-        $stub = str_replace('DummyModelVariable', camel_case($class), $stub);
161
+        $stub = str_replace( 'DummyModelNamespace', $model, $stub );
162
+        $stub = str_replace( 'DummyModelClass', $class, $stub );
163
+        $stub = str_replace( 'DummyModelVariable', camel_case( $class ), $stub );
164 164
 
165 165
         return $stub;
166 166
     }
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
      * @param  string $name
172 172
      * @return string
173 173
      */
174
-    protected function getModelNamespace(string $name):string
174
+    protected function getModelNamespace( string $name ):string
175 175
     {
176
-        if ($this->option('model')) {
177
-            return $this->option('model');
176
+        if ( $this->option( 'model' ) ) {
177
+            return $this->option( 'model' );
178 178
         }
179 179
 
180
-        return 'App\\' . str_replace('Transformer', '', $name);
180
+        return 'App\\' . str_replace( 'Transformer', '', $name );
181 181
     }
182 182
 
183 183
     /**
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
      * @param  string $namespace
187 187
      * @return string
188 188
      */
189
-    protected function getClassFromNamespace(string $namespace):string
189
+    protected function getClassFromNamespace( string $namespace ):string
190 190
     {
191
-        return last(explode('\\', $namespace));
191
+        return last( explode( '\\', $namespace ) );
192 192
     }
193 193
 }
194 194
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exceptions/InvalidSerializerException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,6 +19,6 @@
 block discarded – undo
19 19
      */
20 20
     public function __construct()
21 21
     {
22
-        parent::__construct('Given serializer is not an instance of [' . SerializerAbstract::class . '].');
22
+        parent::__construct( 'Given serializer is not an instance of [' . SerializerAbstract::class . '].' );
23 23
     }
24 24
 }
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exceptions/InvalidTransformerException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@
 block discarded – undo
19 19
      *
20 20
      * @param Model $model
21 21
      */
22
-    public function __construct(Model $model)
22
+    public function __construct( Model $model )
23 23
     {
24
-        parent::__construct('The given transformer does not exist for model [' . get_class($model) . '].');
24
+        parent::__construct( 'The given transformer does not exist for model [' . get_class( $model ) . '].' );
25 25
     }
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exceptions/Handler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
      * @param  Exception                $exception
19 19
      * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
20 20
      */
21
-    public function render($request, Exception $exception)
21
+    public function render( $request, Exception $exception )
22 22
     {
23
-        $this->transformException($exception);
23
+        $this->transformException( $exception );
24 24
 
25
-        if ($exception instanceof ApiException) {
26
-            return $this->renderApiError($exception);
25
+        if ( $exception instanceof ApiException ) {
26
+            return $this->renderApiError( $exception );
27 27
         }
28 28
 
29
-        return parent::render($request, $exception);
29
+        return parent::render( $request, $exception );
30 30
     }
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
src/Traits/RespondsWithJson.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
      * @param  mixed       $message
25 25
      * @return JsonResponse
26 26
      */
27
-    public function errorResponse(string $errorCode = null, int $statusCode = null, $message = null):JsonResponse
27
+    public function errorResponse( string $errorCode = null, int $statusCode = null, $message = null ):JsonResponse
28 28
     {
29
-        return app(Responder::class)->error($errorCode, $statusCode, $message);
29
+        return app( Responder::class )->error( $errorCode, $statusCode, $message );
30 30
     }
31 31
 
32 32
     /**
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
      * @param  array      $meta
38 38
      * @return \Illuminate\Http\JsonResponse
39 39
      */
40
-    public function successResponse($data = null, $statusCode = null, array $meta = []):JsonResponse
40
+    public function successResponse( $data = null, $statusCode = null, array $meta = [ ] ):JsonResponse
41 41
     {
42
-        return app(Responder::class)->success($data, $statusCode, $meta);
42
+        return app( Responder::class )->success( $data, $statusCode, $meta );
43 43
     }
44 44
 
45 45
     /**
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
      * @param  callable|string|null $transformer
50 50
      * @return \Flugg\Responder\Http\SuccessResponse
51 51
      */
52
-    public function transform($data = null, $transformer = null):SuccessResponseBuilder
52
+    public function transform( $data = null, $transformer = null ):SuccessResponseBuilder
53 53
     {
54
-        return app(Responder::class)->transform($data, $transformer);
54
+        return app( Responder::class )->transform( $data, $transformer );
55 55
     }
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
src/Http/ErrorResponseBuilder.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      *
21 21
      * @var array
22 22
      */
23
-    protected $data = [];
23
+    protected $data = [ ];
24 24
 
25 25
     /**
26 26
      * The error code used to identify the error.
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      *
42 42
      * @var array
43 43
      */
44
-    protected $parameters = [];
44
+    protected $parameters = [ ];
45 45
 
46 46
     /**
47 47
      * The HTTP status code for the response.
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
      * @param \Illuminate\Contracts\Routing\ResponseFactory|\Laravel\Lumen\Http\ResponseFactory $responseFactory
64 64
      * @param \Symfony\Component\Translation\TranslatorInterface                                $translator
65 65
      */
66
-    public function __construct($responseFactory, TranslatorInterface $translator)
66
+    public function __construct( $responseFactory, TranslatorInterface $translator )
67 67
     {
68 68
         $this->translator = $translator;
69 69
 
70
-        parent::__construct($responseFactory);
70
+        parent::__construct( $responseFactory );
71 71
     }
72 72
 
73 73
     /**
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
      * @param  array $data
77 77
      * @return self
78 78
      */
79
-    public function addData(array $data):ErrorResponseBuilder
79
+    public function addData( array $data ):ErrorResponseBuilder
80 80
     {
81
-        $this->data = array_merge($this->data, $data);
81
+        $this->data = array_merge( $this->data, $data );
82 82
 
83 83
         return $this;
84 84
     }
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
      * @param  string|array|null $message
91 91
      * @return self
92 92
      */
93
-    public function setError(string $errorCode = null, $message = null):ErrorResponseBuilder
93
+    public function setError( string $errorCode = null, $message = null ):ErrorResponseBuilder
94 94
     {
95 95
         $this->errorCode = $errorCode;
96 96
 
97
-        if (is_array($message)) {
97
+        if ( is_array( $message ) ) {
98 98
             $this->parameters = $message;
99 99
         } else {
100 100
             $this->message = $message;
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
      * @return self
111 111
      * @throws \InvalidArgumentException
112 112
      */
113
-    public function setStatus(int $statusCode):ResponseBuilder
113
+    public function setStatus( int $statusCode ):ResponseBuilder
114 114
     {
115
-        if ($statusCode < 400 || $statusCode >= 600) {
116
-            throw new InvalidArgumentException("{$statusCode} is not a valid error HTTP status code.");
115
+        if ( $statusCode < 400 || $statusCode >= 600 ) {
116
+            throw new InvalidArgumentException( "{$statusCode} is not a valid error HTTP status code." );
117 117
         }
118 118
 
119
-        return parent::setStatus($statusCode);
119
+        return parent::setStatus( $statusCode );
120 120
     }
121 121
 
122 122
     /**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     protected function buildErrorData()
141 141
     {
142
-        if (is_null($this->errorCode)) {
142
+        if ( is_null( $this->errorCode ) ) {
143 143
             return null;
144 144
         }
145 145
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             'message' => $this->message ?: $this->resolveMessage()
149 149
         ];
150 150
 
151
-        return array_merge($data, $this->data);
151
+        return array_merge( $data, $this->data );
152 152
     }
153 153
 
154 154
     /**
@@ -158,10 +158,10 @@  discard block
 block discarded – undo
158 158
      */
159 159
     protected function resolveMessage()
160 160
     {
161
-        if (! $this->translator->has($code = "errors.$this->errorCode")) {
161
+        if ( ! $this->translator->has( $code = "errors.$this->errorCode" ) ) {
162 162
             return null;
163 163
         }
164 164
 
165
-        return $this->translator->trans($code, $this->parameters);
165
+        return $this->translator->trans( $code, $this->parameters );
166 166
     }
167 167
 }
168 168
\ No newline at end of file
Please login to merge, or discard this patch.
src/Http/ResponseBuilder.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      *
45 45
      * @param \Illuminate\Contracts\Routing\ResponseFactory|\Laravel\Lumen\Http\ResponseFactory $responseFactory
46 46
      */
47
-    public function __construct($responseFactory)
47
+    public function __construct( $responseFactory )
48 48
     {
49 49
         $this->responseFactory = $responseFactory;
50 50
     }
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
      * @param  array    $headers
57 57
      * @return \Illuminate\Http\JsonResponse
58 58
      */
59
-    public function respond(int $statusCode = null, array $headers = []):JsonResponse
59
+    public function respond( int $statusCode = null, array $headers = [ ] ):JsonResponse
60 60
     {
61
-        if (! is_null($statusCode)) {
62
-            $this->setStatus($statusCode);
61
+        if ( ! is_null( $statusCode ) ) {
62
+            $this->setStatus( $statusCode );
63 63
         }
64 64
 
65
-        $data = $this->includeStatusCode($this->toArray());
65
+        $data = $this->includeStatusCode( $this->toArray() );
66 66
 
67
-        return $this->responseFactory->json($data, $this->statusCode, $headers);
67
+        return $this->responseFactory->json( $data, $this->statusCode, $headers );
68 68
     }
69 69
 
70 70
     /**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * @param  int $statusCode
74 74
      * @return self
75 75
      */
76
-    public function setStatus(int $statusCode):ResponseBuilder
76
+    public function setStatus( int $statusCode ):ResponseBuilder
77 77
     {
78 78
         $this->statusCode = $statusCode;
79 79
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @param  bool $includeStatusCode
87 87
      * @return self
88 88
      */
89
-    public function setIncludeStatusCode(bool $includeStatusCode):ResponseBuilder
89
+    public function setIncludeStatusCode( bool $includeStatusCode ):ResponseBuilder
90 90
     {
91 91
         $this->includeStatusCode = $includeStatusCode;
92 92
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      */
101 101
     public function toCollection():Collection
102 102
     {
103
-        return new Collection($this->toArray());
103
+        return new Collection( $this->toArray() );
104 104
     }
105 105
 
106 106
     /**
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
      * @param  int $options
110 110
      * @return string
111 111
      */
112
-    public function toJson($options = 0)
112
+    public function toJson( $options = 0 )
113 113
     {
114
-        return json_encode($this->jsonSerialize(), $options);
114
+        return json_encode( $this->jsonSerialize(), $options );
115 115
     }
116 116
 
117 117
     /**
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
      * @param  array $data
138 138
      * @return array
139 139
      */
140
-    protected function includeStatusCode(array $data):array
140
+    protected function includeStatusCode( array $data ):array
141 141
     {
142
-        if (! $this->includeStatusCode) {
142
+        if ( ! $this->includeStatusCode ) {
143 143
             return $data;
144 144
         }
145 145
 
146
-        return array_merge(['status' => $this->statusCode], $data);
146
+        return array_merge( [ 'status' => $this->statusCode ], $data );
147 147
     }
148 148
 }
149 149
\ No newline at end of file
Please login to merge, or discard this patch.
src/Traits/HandlesApiErrors.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
      * @param  Exception $exception
33 33
      * @return void
34 34
      */
35
-    protected function transformException(Exception $exception)
35
+    protected function transformException( Exception $exception )
36 36
     {
37
-        if (Request::capture()->wantsJson()) {
38
-            $this->transformAuthException($exception);
39
-            $this->transformEloquentException($exception);
40
-            $this->transformValidationException($exception);
37
+        if ( Request::capture()->wantsJson() ) {
38
+            $this->transformAuthException( $exception );
39
+            $this->transformEloquentException( $exception );
40
+            $this->transformValidationException( $exception );
41 41
         }
42 42
     }
43 43
 
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
      * @throws UnauthenticatedException
50 50
      * @throws UnauthorizedException
51 51
      */
52
-    protected function transformAuthException(Exception $exception)
52
+    protected function transformAuthException( Exception $exception )
53 53
     {
54
-        if ($exception instanceof AuthenticationException) {
54
+        if ( $exception instanceof AuthenticationException ) {
55 55
             throw new UnauthenticatedException();
56 56
         }
57 57
 
58
-        if ($exception instanceof AuthorizationException) {
58
+        if ( $exception instanceof AuthorizationException ) {
59 59
             throw new UnauthorizedException();
60 60
         }
61 61
     }
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
      * @throws ResourceNotFoundException
69 69
      * @throws RelationNotFoundException
70 70
      */
71
-    protected function transformEloquentException(Exception $exception)
71
+    protected function transformEloquentException( Exception $exception )
72 72
     {
73
-        if ($exception instanceof ModelNotFoundException) {
73
+        if ( $exception instanceof ModelNotFoundException ) {
74 74
             throw new ResourceNotFoundException();
75 75
         }
76 76
 
77
-        if ($exception instanceof RelationNotFoundException) {
77
+        if ( $exception instanceof RelationNotFoundException ) {
78 78
             throw new RelationNotFoundException();
79 79
         }
80 80
     }
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
      * @return void
87 87
      * @throws ValidationFailedException
88 88
      */
89
-    protected function transformValidationException(Exception $exception)
89
+    protected function transformValidationException( Exception $exception )
90 90
     {
91
-        if ($exception instanceof ValidationException) {
92
-            throw new ValidationFailedException($exception->validator);
91
+        if ( $exception instanceof ValidationException ) {
92
+            throw new ValidationFailedException( $exception->validator );
93 93
         }
94 94
     }
95 95
 
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
      * @param  ApiException $exception
100 100
      * @return JsonResponse
101 101
      */
102
-    protected function renderApiError(ApiException $exception):JsonResponse
102
+    protected function renderApiError( ApiException $exception ):JsonResponse
103 103
     {
104
-        return app('responder.error')
105
-            ->setError($exception->getErrorCode(), $exception->getMessage())
106
-            ->addData($exception->getData() ?: [])
107
-            ->respond($exception->getStatusCode());
104
+        return app( 'responder.error' )
105
+            ->setError( $exception->getErrorCode(), $exception->getMessage() )
106
+            ->addData( $exception->getData() ?: [ ] )
107
+            ->respond( $exception->getStatusCode() );
108 108
     }
109 109
 }
110 110
\ 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_unique(array_merge($this->availableIncludes, (array) $relations)));
49
+        $this->setAvailableIncludes( array_unique( 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.