Passed
Push — v2 ( 8c624d...f3844b )
by Alexander
02:24
created
src/Testing/MakesApiRequests.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
      * @param  int   $status
22 22
      * @return $this
23 23
      */
24
-    protected function seeSuccess($data = null, $status = 200)
24
+    protected function seeSuccess( $data = null, $status = 200 )
25 25
     {
26
-        $response = $this->seeSuccessResponse($data, $status);
27
-        $this->seeSuccessData($response->getData(true)['data']);
26
+        $response = $this->seeSuccessResponse( $data, $status );
27
+        $this->seeSuccessData( $response->getData( true )[ 'data' ] );
28 28
 
29 29
         return $this;
30 30
     }
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
      * @param  int   $status
37 37
      * @return $this
38 38
      */
39
-    protected function seeSuccessEquals($data = null, $status = 200)
39
+    protected function seeSuccessEquals( $data = null, $status = 200 )
40 40
     {
41
-        $response = $this->seeSuccessResponse($data, $status);
42
-        $this->seeJsonEquals($response->getData(true));
41
+        $response = $this->seeSuccessResponse( $data, $status );
42
+        $this->seeJsonEquals( $response->getData( true ) );
43 43
 
44 44
         return $this;
45 45
     }
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
      * @param  mixed $data
51 51
      * @return $this
52 52
      */
53
-    protected function seeSuccessStructure($data = null)
53
+    protected function seeSuccessStructure( $data = null )
54 54
     {
55
-        $this->seeJsonStructure([
55
+        $this->seeJsonStructure( [
56 56
             'data' => $data,
57
-        ]);
57
+        ] );
58 58
 
59 59
         return $this;
60 60
     }
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
      * @param  int   $status
67 67
      * @return \Illuminate\Http\JsonResponse
68 68
      */
69
-    protected function seeSuccessResponse($data = null, $status = 200): JsonResponse
69
+    protected function seeSuccessResponse( $data = null, $status = 200 ): JsonResponse
70 70
     {
71
-        $response = $this->app->make(Responder::class)->success($data, $status);
71
+        $response = $this->app->make( Responder::class )->success( $data, $status );
72 72
 
73
-        $this->seeStatusCode($response->getStatusCode())->seeJson([
73
+        $this->seeStatusCode( $response->getStatusCode() )->seeJson( [
74 74
             'success' => true,
75 75
             'status' => $response->getStatusCode(),
76
-        ])->seeJsonStructure(['data']);
76
+        ] )->seeJsonStructure( [ 'data' ] );
77 77
 
78 78
         return $response;
79 79
     }
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
      * @param  mixed $data
85 85
      * @return $this
86 86
      */
87
-    protected function seeSuccessData($data = null)
87
+    protected function seeSuccessData( $data = null )
88 88
     {
89
-        collect($data)->each(function ($value, $key) {
90
-            if (is_array($value)) {
91
-                $this->seeSuccessData($value);
89
+        collect( $data )->each( function ( $value, $key ) {
90
+            if ( is_array( $value ) ) {
91
+                $this->seeSuccessData( $value );
92 92
             } else {
93
-                $this->seeJson([$key => $value]);
93
+                $this->seeJson( [ $key => $value ] );
94 94
             }
95 95
         });
96 96
 
@@ -103,20 +103,20 @@  discard block
 block discarded – undo
103 103
      * @param  string|array|null $attributes
104 104
      * @return array
105 105
      */
106
-    protected function getSuccessData($attributes = null)
106
+    protected function getSuccessData( $attributes = null )
107 107
     {
108
-        $rawData = $this->decodeResponseJson()['data'];
108
+        $rawData = $this->decodeResponseJson()[ 'data' ];
109 109
 
110
-        if (is_null($attributes)) {
110
+        if ( is_null( $attributes ) ) {
111 111
             return $rawData;
112
-        } elseif (is_string($attributes)) {
113
-            return array_get($rawData, $attributes);
112
+        } elseif ( is_string( $attributes ) ) {
113
+            return array_get( $rawData, $attributes );
114 114
         }
115 115
 
116
-        $data = [];
116
+        $data = [ ];
117 117
 
118
-        foreach ($attributes as $attribute) {
119
-            $data[] = array_get($rawData, $attribute);
118
+        foreach ( $attributes as $attribute ) {
119
+            $data[ ] = array_get( $rawData, $attribute );
120 120
         }
121 121
 
122 122
         return $data;
@@ -129,25 +129,25 @@  discard block
 block discarded – undo
129 129
      * @param  int|null $status
130 130
      * @return $this
131 131
      */
132
-    protected function seeError(string $error, int $status = null)
132
+    protected function seeError( string $error, int $status = null )
133 133
     {
134
-        if (! is_null($status)) {
135
-            $this->seeStatusCode($status);
134
+        if ( ! is_null( $status ) ) {
135
+            $this->seeStatusCode( $status );
136 136
         }
137 137
 
138
-        if ($this->app->config->get('responder.status_code')) {
139
-            $this->seeJson([
138
+        if ( $this->app->config->get( 'responder.status_code' ) ) {
139
+            $this->seeJson( [
140 140
                 'status' => $status,
141
-            ]);
141
+            ] );
142 142
         }
143 143
 
144
-        return $this->seeJson([
144
+        return $this->seeJson( [
145 145
             'success' => false,
146
-        ])->seeJsonSubset([
146
+        ] )->seeJsonSubset( [
147 147
             'error' => [
148 148
                 'code' => $error,
149 149
             ],
150
-        ]);
150
+        ] );
151 151
     }
152 152
 
153 153
     /**
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      * @param  int $status
157 157
      * @return $this
158 158
      */
159
-    abstract protected function seeStatusCode($status);
159
+    abstract protected function seeStatusCode( $status );
160 160
 
161 161
     /**
162 162
      * Assert that the response contains JSON.
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      * @param  bool       $negate
166 166
      * @return $this
167 167
      */
168
-    abstract public function seeJson(array $data = null, $negate = false);
168
+    abstract public function seeJson( array $data = null, $negate = false );
169 169
 
170 170
     /**
171 171
      * Assert that the JSON response has a given structure.
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      * @param  array|null $responseData
175 175
      * @return $this
176 176
      */
177
-    abstract public function seeJsonStructure(array $structure = null, $responseData = null);
177
+    abstract public function seeJsonStructure( array $structure = null, $responseData = null );
178 178
 
179 179
     /**
180 180
      * Assert that the response is a superset of the given JSON.
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * @param  array $data
183 183
      * @return $this
184 184
      */
185
-    abstract protected function seeJsonSubset(array $data);
185
+    abstract protected function seeJsonSubset( array $data );
186 186
 
187 187
     /**
188 188
      * Assert that the response contains an exact JSON array.
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      * @param  array $data
191 191
      * @return $this
192 192
      */
193
-    abstract public function seeJsonEquals(array $data);
193
+    abstract public function seeJsonEquals( array $data );
194 194
 
195 195
     /**
196 196
      * Validate and return the decoded response JSON.
Please login to merge, or discard this patch.
src/Transformer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @param \Flugg\Responder\TransformBuilder $transformBuilder
28 28
      */
29
-    public function __construct(TransformBuilder $transformBuilder)
29
+    public function __construct( TransformBuilder $transformBuilder )
30 30
     {
31 31
         $this->transformBuilder = $transformBuilder;
32 32
     }
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
      * @param  string[]                                                       $without
41 41
      * @return array
42 42
      */
43
-    public function transform($data = null, $transformer = null, array $with = [], array $without = []): array
43
+    public function transform( $data = null, $transformer = null, array $with = [ ], array $without = [ ] ): array
44 44
     {
45
-        return $this->transformBuilder->resource($data, $transformer)
46
-            ->with($with)
47
-            ->without($without)
48
-            ->serializer(new NullSerializer)
45
+        return $this->transformBuilder->resource( $data, $transformer )
46
+            ->with( $with )
47
+            ->without( $without )
48
+            ->serializer( new NullSerializer )
49 49
             ->transform();
50 50
     }
51 51
 }
52 52
\ 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 must be an instance of [' . SerializerAbstract::class . '].');
22
+        parent::__construct( 'Given serializer must be 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/Http/ValidationFailedException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      *
41 41
      * @param \Illuminate\Contracts\Validation\Validator $validator
42 42
      */
43
-    public function __construct(Validator $validator)
43
+    public function __construct( Validator $validator )
44 44
     {
45 45
         $this->validator = $validator;
46 46
 
@@ -54,6 +54,6 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function data()
56 56
     {
57
-        return [$this->validator->getMessageBag()->toArray()];
57
+        return [ $this->validator->getMessageBag()->toArray() ];
58 58
     }
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
src/Exceptions/InvalidTransformerException.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 transformer must be a callable or an instance of [' . Transformer::class . '].');
22
+        parent::__construct( 'Given transformer must be a callable or an instance of [' . Transformer::class . '].' );
23 23
     }
24 24
 }
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
src/Pagination/PaginatorFactory.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      *
30 30
      * @param array $parameters
31 31
      */
32
-    public function __construct(array $parameters)
32
+    public function __construct( array $parameters )
33 33
     {
34 34
         $this->parameters = $parameters;
35 35
     }
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
      * @param  \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator
41 41
      * @return \League\Fractal\Pagination\PaginatorInterface
42 42
      */
43
-    public function make(LengthAwarePaginator $paginator): PaginatorInterface
43
+    public function make( LengthAwarePaginator $paginator ): PaginatorInterface
44 44
     {
45
-        $paginator->appends($this->parameters);
45
+        $paginator->appends( $this->parameters );
46 46
 
47
-        return new IlluminatePaginatorAdapter($paginator);
47
+        return new IlluminatePaginatorAdapter( $paginator );
48 48
     }
49 49
 
50 50
     /**
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
      * @param  \Flugg\Responder\Pagination\CursorPaginator $paginator
54 54
      * @return \League\Fractal\Pagination\Cursor
55 55
      */
56
-    public function makeCursor(CursorPaginator $paginator): Cursor
56
+    public function makeCursor( CursorPaginator $paginator ): Cursor
57 57
     {
58
-        $paginator->appends($this->parameters);
58
+        $paginator->appends( $this->parameters );
59 59
 
60
-        return new Cursor($paginator->cursor(), $paginator->previous(), $paginator->next(), $paginator->get()->count());
60
+        return new Cursor( $paginator->cursor(), $paginator->previous(), $paginator->next(), $paginator->get()->count() );
61 61
     }
62 62
 }
Please login to merge, or discard this patch.
src/Pagination/CursorPaginator.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
      * @param int|string|null                           $previousCursor
59 59
      * @param int|string|null                           $nextCursor
60 60
      */
61
-    public function __construct($data, $cursor, $previousCursor, $nextCursor)
61
+    public function __construct( $data, $cursor, $previousCursor, $nextCursor )
62 62
     {
63 63
         $this->cursor = $cursor;
64 64
         $this->previousCursor = $previousCursor;
65 65
         $this->nextCursor = $nextCursor;
66 66
 
67
-        $this->set($data);
67
+        $this->set( $data );
68 68
     }
69 69
 
70 70
     /**
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
      * @param  \Illuminate\Support\Collection|array|null $data
124 124
      * @return self
125 125
      */
126
-    public function set($data): CursorPaginator
126
+    public function set( $data ): CursorPaginator
127 127
     {
128
-        $this->items = $data instanceof Collection ? $data : Collection::make($data);;
128
+        $this->items = $data instanceof Collection ? $data : Collection::make( $data ); ;
129 129
 
130 130
         return $this;
131 131
     }
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
      * @return mixed
138 138
      * @throws \LogicException
139 139
      */
140
-    public static function resolveCursor(string $name = 'cursor')
140
+    public static function resolveCursor( string $name = 'cursor' )
141 141
     {
142
-        if (isset(static::$currentCursorResolver)) {
143
-            return call_user_func(static::$currentCursorResolver, $name);
142
+        if ( isset(static::$currentCursorResolver) ) {
143
+            return call_user_func( static::$currentCursorResolver, $name );
144 144
         }
145 145
 
146
-        throw new LogicException("Could not resolve cursor with the name [{$name}].");
146
+        throw new LogicException( "Could not resolve cursor with the name [{$name}]." );
147 147
     }
148 148
 
149 149
     /**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      * @param  \Closure $resolver
153 153
      * @return void
154 154
      */
155
-    public static function cursorResolver(Closure $resolver)
155
+    public static function cursorResolver( Closure $resolver )
156 156
     {
157 157
         static::$currentCursorResolver = $resolver;
158 158
     }
Please login to merge, or discard this patch.
src/Serializers/NullSerializer.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      * @param  array  $data
22 22
      * @return array
23 23
      */
24
-    public function collection($resourceKey, array $data)
24
+    public function collection( $resourceKey, array $data )
25 25
     {
26 26
         return $data;
27 27
     }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param  array  $data
34 34
      * @return array
35 35
      */
36
-    public function item($resourceKey, array $data)
36
+    public function item( $resourceKey, array $data )
37 37
     {
38 38
         return $data;
39 39
     }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function null()
47 47
     {
48
-        return [];
48
+        return [ ];
49 49
     }
50 50
 
51 51
     /**
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
      * @param  array $meta
55 55
      * @return array
56 56
      */
57
-    public function meta(array $meta)
57
+    public function meta( array $meta )
58 58
     {
59
-        return [];
59
+        return [ ];
60 60
     }
61 61
 
62 62
     /**
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
      * @param  \League\Fractal\Pagination\PaginatorInterface $paginator
66 66
      * @return array
67 67
      */
68
-    public function paginator(PaginatorInterface $paginator)
68
+    public function paginator( PaginatorInterface $paginator )
69 69
     {
70
-        return [];
70
+        return [ ];
71 71
     }
72 72
 
73 73
     /**
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
      * @param  \League\Fractal\Pagination\CursorInterface $cursor
77 77
      * @return array
78 78
      */
79
-    public function cursor(CursorInterface $cursor)
79
+    public function cursor( CursorInterface $cursor )
80 80
     {
81
-        return [];
81
+        return [ ];
82 82
     }
83 83
 
84 84
     /**
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
      * @param  array $includedData
89 89
      * @return array
90 90
      */
91
-    public function mergeIncludes($transformedData, $includedData)
91
+    public function mergeIncludes( $transformedData, $includedData )
92 92
     {
93
-        return array_merge($transformedData, $includedData);
93
+        return array_merge( $transformedData, $includedData );
94 94
     }
95 95
 }
Please login to merge, or discard this patch.
src/Serializers/ErrorSerializer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      * @param  array|null  $data
22 22
      * @return array
23 23
      */
24
-    public function format(string $errorCode = null, string $message = null, array $data = null): array
24
+    public function format( string $errorCode = null, string $message = null, array $data = null ): array
25 25
     {
26 26
         return [
27 27
             'error' => [
Please login to merge, or discard this patch.