Test Setup Failed
Push — v2 ( e7c783...0db518 )
by Alexander
14:51 queued 07:04
created
src/Http/Responses/Decorators/StatusCodeDecorator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@
 block discarded – undo
21 21
      * @param  array $headers
22 22
      * @return \Illuminate\Http\JsonResponse
23 23
      */
24
-    public function make(array $data, int $status, array $headers = []): JsonResponse
24
+    public function make( array $data, int $status, array $headers = [ ] ): JsonResponse
25 25
     {
26
-        return $this->factory->make(array_merge([
26
+        return $this->factory->make( array_merge( [
27 27
             'status' => $status,
28
-        ], $data), $status, $headers);
28
+        ], $data ), $status, $headers );
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
src/Http/Responses/ErrorResponseBuilder.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
      * @param \Flugg\Responder\Contracts\ResponseFactory $responseFactory
57 57
      * @param \Flugg\Responder\Contracts\ErrorFactory    $errorFactory
58 58
      */
59
-    public function __construct(ResponseFactory $responseFactory, ErrorFactory $errorFactory)
59
+    public function __construct( ResponseFactory $responseFactory, ErrorFactory $errorFactory )
60 60
     {
61 61
         $this->errorFactory = $errorFactory;
62 62
 
63
-        parent::__construct($responseFactory);
63
+        parent::__construct( $responseFactory );
64 64
     }
65 65
 
66 66
     /**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param  string|null $message
71 71
      * @return self
72 72
      */
73
-    public function error(string $errorCode = null, string $message = null): ErrorResponseBuilder
73
+    public function error( string $errorCode = null, string $message = null ): ErrorResponseBuilder
74 74
     {
75 75
         $this->errorCode = $errorCode;
76 76
         $this->message = $message;
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
      * @param  array $data
85 85
      * @return self
86 86
      */
87
-    public function data(array $data): ErrorResponseBuilder
87
+    public function data( array $data ): ErrorResponseBuilder
88 88
     {
89
-        $this->data = array_merge((array) $this->data, $data);
89
+        $this->data = array_merge( (array) $this->data, $data );
90 90
 
91 91
         return $this;
92 92
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     protected function getOutput(): array
100 100
     {
101
-        return $this->errorFactory->make($this->errorCode, $this->message, $this->data);
101
+        return $this->errorFactory->make( $this->errorCode, $this->message, $this->data );
102 102
     }
103 103
 
104 104
     /**
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
      * @return void
109 109
      * @throws \InvalidArgumentException
110 110
      */
111
-    protected function validateStatusCode(int $status): void
111
+    protected function validateStatusCode( int $status ): void
112 112
     {
113
-        if ($status < 400 || $status >= 600) {
114
-            throw new InvalidArgumentException("{$status} is not a valid error HTTP status code.");
113
+        if ( $status < 400 || $status >= 600 ) {
114
+            throw new InvalidArgumentException( "{$status} is not a valid error HTTP status code." );
115 115
         }
116 116
     }
117 117
 }
118 118
\ No newline at end of file
Please login to merge, or discard this patch.
src/Http/Middleware/ConvertToSnakeCase.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@
 block discarded – undo
30 30
      * @param  array $data
31 31
      * @return array
32 32
      */
33
-    protected function cleanArray(array $data)
33
+    protected function cleanArray( array $data )
34 34
     {
35
-        return collect($data)->mapWithKeys(function ($value, $key) {
36
-            $key = in_array($key, $this->except) ? $key : snake_case($key);
35
+        return collect( $data )->mapWithKeys( function ( $value, $key ) {
36
+            $key = in_array( $key, $this->except ) ? $key : snake_case( $key );
37 37
 
38
-            return [$key => $value];
38
+            return [ $key => $value ];
39 39
         })->all();
40 40
     }
41 41
 }
Please login to merge, or discard this patch.
src/Resources/DataNormalizer.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
      * @param  mixed $data
27 27
      * @return mixed
28 28
      */
29
-    public function normalize($data = null)
29
+    public function normalize( $data = null )
30 30
     {
31
-        if ($data instanceof Builder || $data instanceof CursorPaginator) {
31
+        if ( $data instanceof Builder || $data instanceof CursorPaginator ) {
32 32
             return $data->get();
33
-        } elseif ($data instanceof Paginator) {
33
+        } elseif ( $data instanceof Paginator ) {
34 34
             return $data->getCollection();
35
-        } elseif ($data instanceof Relation) {
36
-            return $this->normalizeRelation($data);
35
+        } elseif ( $data instanceof Relation ) {
36
+            return $this->normalizeRelation( $data );
37 37
         }
38 38
 
39 39
         return $data;
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
      * @param  \Illuminate\Database\Eloquent\Relations\Relation $relation
46 46
      * @return \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|null
47 47
      */
48
-    protected function normalizeRelation(Relation $relation)
48
+    protected function normalizeRelation( Relation $relation )
49 49
     {
50
-        return $this->isSingularRelation($relation) ? $relation->first() : $relation->get();
50
+        return $this->isSingularRelation( $relation ) ? $relation->first() : $relation->get();
51 51
     }
52 52
 
53 53
     /**
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
      * @param  \Illuminate\Database\Eloquent\Relations\Relation $relation
57 57
      * @return bool
58 58
      */
59
-    protected function isSingularRelation(Relation $relation): bool
59
+    protected function isSingularRelation( Relation $relation ): bool
60 60
     {
61
-        $singularRelations = [BelongsTo::class, HasOne::class, MorphOne::class, MorphTo::class];
61
+        $singularRelations = [ BelongsTo::class, HasOne::class, MorphOne::class, MorphTo::class ];
62 62
 
63
-        foreach ($singularRelations as $singularRelation) {
64
-            if ($relation instanceof $singularRelation) {
63
+        foreach ( $singularRelations as $singularRelation ) {
64
+            if ( $relation instanceof $singularRelation ) {
65 65
                 return true;
66 66
             }
67 67
         }
Please login to merge, or discard this patch.
src/Transformers/Concerns/OverridesFractal.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function getDefaultIncludes()
32 32
     {
33
-        return array_keys($this->with);
33
+        return array_keys( $this->with );
34 34
     }
35 35
 
36 36
     /**
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
      * @param  mixed                 $data
42 42
      * @return \League\Fractal\Resource\ResourceInterface|false
43 43
      */
44
-    protected function callIncludeMethod(Scope $scope, $relation, $data)
44
+    protected function callIncludeMethod( Scope $scope, $relation, $data )
45 45
     {
46
-        $parameters = $this->getScopedParameters($scope, $relation);
47
-        $resource = $this->makeResource($relation, $data, $parameters);
46
+        $parameters = $this->getScopedParameters( $scope, $relation );
47
+        $resource = $this->makeResource( $relation, $data, $parameters );
48 48
 
49 49
         return $resource;
50 50
     }
Please login to merge, or discard this patch.
src/Transformers/Concerns/HasRelationships.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
      *
17 17
      * @var string[]
18 18
      */
19
-    protected $relations = ['*'];
19
+    protected $relations = [ '*' ];
20 20
 
21 21
     /**
22 22
      * A list of autoloaded default relations.
23 23
      *
24 24
      * @var array
25 25
      */
26
-    protected $load = [];
26
+    protected $load = [ ];
27 27
 
28 28
     /**
29 29
      * Indicates if the transformer has whitelisted all relations.
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function allRelationsAllowed(): bool
34 34
     {
35
-        return $this->relations == ['*'];
35
+        return $this->relations == [ '*' ];
36 36
     }
37 37
 
38 38
     /**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function getRelations(): array
44 44
     {
45
-        return array_filter($this->relations, function ($relation) {
45
+        return array_filter( $this->relations, function ( $relation ) {
46 46
             return $relation !== '*';
47 47
         });
48 48
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function getDefaultRelations(): array
56 56
     {
57
-        return array_keys($this->load);
57
+        return array_keys( $this->load );
58 58
     }
59 59
 
60 60
     /**
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function extractDefaultRelations(): array
66 66
     {
67
-        return collect($this->getDefaultRelations())->merge($this->load->map(function ($transformer, $relation) {
68
-            return collect($this->resolveTransformer($transformer)->extractDefaultRelations())
67
+        return collect( $this->getDefaultRelations() )->merge( $this->load->map( function ( $transformer, $relation ) {
68
+            return collect( $this->resolveTransformer( $transformer )->extractDefaultRelations() )
69 69
                 ->keys()
70
-                ->map(function ($nestedRelation) use ($relation) {
70
+                ->map( function ( $nestedRelation ) use ($relation) {
71 71
                     return "$relation.$nestedRelation";
72 72
                 });
73
-        }))->all();
73
+        }) )->all();
74 74
     }
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
src/Transformers/Concerns/MakesResources.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      *
22 22
      * @var \League\Fractal\ResourceInterface
23 23
      */
24
-    protected $resources = [];
24
+    protected $resources = [ ];
25 25
 
26 26
     /**
27 27
      * The resource builder resolver callback.
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
      * @param  string|null                                                    $resourceKey
39 39
      * @return void
40 40
      */
41
-    public function resource($data = null, $transformer = null, string $resourceKey = null)
41
+    public function resource( $data = null, $transformer = null, string $resourceKey = null )
42 42
     {
43
-        return static::resolveResourceBuilder()->make($data, $transformer)->withResourceKey($resourceKey)->get();
43
+        return static::resolveResourceBuilder()->make( $data, $transformer )->withResourceKey( $resourceKey )->get();
44 44
     }
45 45
 
46 46
     /**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param  \Closure $resolver
50 50
      * @return void
51 51
      */
52
-    public static function resourceBuilderResolver(Closure $resolver)
52
+    public static function resourceBuilderResolver( Closure $resolver )
53 53
     {
54 54
         static::$resourceBuilderResolver = $resolver;
55 55
     }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      */
62 62
     protected static function resolveResourceBuilder()
63 63
     {
64
-        return call_user_func(static::$currentCursorResolver, $name);
64
+        return call_user_func( static::$currentCursorResolver, $name );
65 65
     }
66 66
 
67 67
     /**
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
      * @param \League\Fractal\ParamBag $parameters
73 73
      * @return \League\Fractal\Resource\ResourceInterface|false
74 74
      */
75
-    protected function makeResource(string $relation, $data, ParamBag $parameters)
75
+    protected function makeResource( string $relation, $data, ParamBag $parameters )
76 76
     {
77
-        if (method_exists($this, $method = 'include' . ucfirst($relation))) {
78
-            return $this->$method($data, $parameters);
77
+        if ( method_exists( $this, $method = 'include' . ucfirst( $relation ) ) ) {
78
+            return $this->$method( $data, $parameters );
79 79
         }
80 80
 
81 81
         return $data instanceof Model ? $this->makeResourceFromModel() : false;
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
      * @param  \Illuminate\Database\Eloquent\Model $model
89 89
      * @return \League\Fractal\Resource\ResourceInterface|bool
90 90
      */
91
-    protected function makeResourceFromModel(string $relation, Model $model)
91
+    protected function makeResourceFromModel( string $relation, Model $model )
92 92
     {
93 93
         $data = $model->$relation;
94 94
 
95
-        if (key_exists($relation, $this->resources)) {
96
-            return $this->resources[$relation]->setData($data);
95
+        if ( key_exists( $relation, $this->resources ) ) {
96
+            return $this->resources[ $relation ]->setData( $data );
97 97
         }
98 98
 
99
-        return $this->resource($data);
99
+        return $this->resource( $data );
100 100
     }
101 101
 
102 102
     /**
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
      * @param  string                $relation
107 107
      * @return \League\Fractal\ParamBag
108 108
      */
109
-    protected function getScopedParameters(Scope $scope, string $relation): ParamBag
109
+    protected function getScopedParameters( Scope $scope, string $relation ): ParamBag
110 110
     {
111
-        return $scope->getManager()->getIncludeParams($scope->getIdentifier($relation));
111
+        return $scope->getManager()->getIncludeParams( $scope->getIdentifier( $relation ) );
112 112
     }
113 113
 }
114 114
\ No newline at end of file
Please login to merge, or discard this patch.