Passed
Push — v2 ( 1005f4...220fbf )
by Alexander
02:47
created
src/Http/Responses/ResponseBuilder.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @param \Flugg\Responder\Contracts\ResponseFactory $responseFactory
38 38
      */
39
-    public function __construct(ResponseFactory $responseFactory)
39
+    public function __construct( ResponseFactory $responseFactory )
40 40
     {
41 41
         $this->responseFactory = $responseFactory;
42 42
     }
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
      * @param  array    $headers
49 49
      * @return \Illuminate\Http\JsonResponse
50 50
      */
51
-    public function respond(int $status = null, array $headers = []): JsonResponse
51
+    public function respond( int $status = null, array $headers = [ ] ): JsonResponse
52 52
     {
53
-        if (! is_null($status)) {
54
-            $this->setStatusCode($status);
53
+        if ( ! is_null( $status ) ) {
54
+            $this->setStatusCode( $status );
55 55
         }
56 56
 
57
-        return $this->responseFactory->make($this->toArray(), $this->status, $headers);
57
+        return $this->responseFactory->make( $this->toArray(), $this->status, $headers );
58 58
     }
59 59
 
60 60
     /**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function toCollection(): Collection
76 76
     {
77
-        return new Collection($this->toArray());
77
+        return new Collection( $this->toArray() );
78 78
     }
79 79
 
80 80
     /**
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
      * @param  int $options
84 84
      * @return string
85 85
      */
86
-    public function toJson($options = 0): string
86
+    public function toJson( $options = 0 ): string
87 87
     {
88
-        return json_encode($this->toArray(), $options);
88
+        return json_encode( $this->toArray(), $options );
89 89
     }
90 90
 
91 91
     /**
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
      * @param  int $status
95 95
      * @return void
96 96
      */
97
-    protected function setStatusCode(int $status): void
97
+    protected function setStatusCode( int $status ): void
98 98
     {
99
-        $this->validateStatusCode($this->status = $status);
99
+        $this->validateStatusCode( $this->status = $status );
100 100
     }
101 101
 
102 102
     /**
@@ -112,5 +112,5 @@  discard block
 block discarded – undo
112 112
      * @param  int $status
113 113
      * @return void
114 114
      */
115
-    abstract protected function validateStatusCode(int $status): void;
115
+    abstract protected function validateStatusCode( int $status ): void;
116 116
 }
117 117
\ No newline at end of file
Please login to merge, or discard this patch.
src/Http/Responses/SuccessResponseBuilder.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
      * @param \Flugg\Responder\Contracts\ResponseFactory $responseFactory
47 47
      * @param \Flugg\Responder\TransformBuilder          $transformBuilder
48 48
      */
49
-    public function __construct(ResponseFactory $responseFactory, TransformBuilder $transformBuilder)
49
+    public function __construct( ResponseFactory $responseFactory, TransformBuilder $transformBuilder )
50 50
     {
51 51
         $this->transformBuilder = $transformBuilder;
52 52
 
53
-        parent::__construct($responseFactory);
53
+        parent::__construct( $responseFactory );
54 54
     }
55 55
 
56 56
     /**
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
      * @param  string|null                                                    $resourceKey
62 62
      * @return self
63 63
      */
64
-    public function transform($data = null, $transformer = null, string $resourceKey = null): SuccessResponseBuilder
64
+    public function transform( $data = null, $transformer = null, string $resourceKey = null ): SuccessResponseBuilder
65 65
     {
66
-        $this->transformBuilder->resource($data, $transformer, $resourceKey);
66
+        $this->transformBuilder->resource( $data, $transformer, $resourceKey );
67 67
 
68 68
         return $this;
69 69
     }
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
      * @param  array  $arguments
76 76
      * @return self|void
77 77
      */
78
-    public function __call($name, $arguments)
78
+    public function __call( $name, $arguments )
79 79
     {
80
-        if (in_array($name, ['meta', 'with', 'without', 'serializer', 'paginator', 'cursor'])) {
81
-            $this->transformBuilder->$name(...$arguments);
80
+        if ( in_array( $name, [ 'meta', 'with', 'without', 'serializer', 'paginator', 'cursor' ] ) ) {
81
+            $this->transformBuilder->$name( ...$arguments );
82 82
 
83 83
             return $this;
84 84
         }
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
      * @return void
104 104
      * @throws \InvalidArgumentException
105 105
      */
106
-    protected function validateStatusCode(int $status): void
106
+    protected function validateStatusCode( int $status ): void
107 107
     {
108
-        if ($status < 100 || $status >= 400) {
109
-            throw new InvalidArgumentException("{$status} is not a valid success HTTP status code.");
108
+        if ( $status < 100 || $status >= 400 ) {
109
+            throw new InvalidArgumentException( "{$status} is not a valid success HTTP status code." );
110 110
         }
111 111
     }
112 112
 }
113 113
\ No newline at end of file
Please login to merge, or discard this patch.
src/Http/Responses/Factories/LaravelResponseFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @param \Illuminate\Contracts\Routing\ResponseFactory $factory
29 29
      */
30
-    public function __construct(BaseLaravelResponseFactory $factory)
30
+    public function __construct( BaseLaravelResponseFactory $factory )
31 31
     {
32 32
         $this->factory = $factory;
33 33
     }
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
      * @param  array $headers
41 41
      * @return \Illuminate\Http\JsonResponse
42 42
      */
43
-    public function make(array $data, int $status, array $headers = []): JsonResponse
43
+    public function make( array $data, int $status, array $headers = [ ] ): JsonResponse
44 44
     {
45
-        return $this->factory->json($data, $status, $headers);
45
+        return $this->factory->json( $data, $status, $headers );
46 46
     }
47 47
 }
Please login to merge, or discard this patch.
src/Http/Responses/Factories/LumenResponseFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @param \Laravel\Lumen\Http\ResponseFactory $factory
29 29
      */
30
-    public function __construct(BaseLumenResponseFactory $factory)
30
+    public function __construct( BaseLumenResponseFactory $factory )
31 31
     {
32 32
         $this->factory = $factory;
33 33
     }
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
      * @param  array $headers
41 41
      * @return \Illuminate\Http\JsonResponse
42 42
      */
43
-    public function make(array $data, int $status, array $headers = []): JsonResponse
43
+    public function make( array $data, int $status, array $headers = [ ] ): JsonResponse
44 44
     {
45
-        return $this->factory->json($data, $status, $headers);
45
+        return $this->factory->json( $data, $status, $headers );
46 46
     }
47 47
 }
Please login to merge, or discard this patch.
src/Http/Responses/Decorators/SuccessFlagDecorator.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
             'success' => $status >= 100 || $status < 400,
28
-        ], $data), $status, $headers);
28
+        ], $data ), $status, $headers );
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
src/Http/Responses/Decorators/ResponseDecorator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @param \Flugg\Responder\Contracts\ResponseFactory $factory
28 28
      */
29
-    public function __construct(ResponseFactory $factory)
29
+    public function __construct( ResponseFactory $factory )
30 30
     {
31 31
         $this->factory = $factory;
32 32
     }
@@ -39,5 +39,5 @@  discard block
 block discarded – undo
39 39
      * @param  array $headers
40 40
      * @return \Illuminate\Http\JsonResponse
41 41
      */
42
-    abstract public function make(array $data, int $status, array $headers = []): JsonResponse;
42
+    abstract public function make( array $data, int $status, array $headers = [ ] ): JsonResponse;
43 43
 }
Please login to merge, or discard this patch.
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.