Completed
Push — master ( 3009e5...7ecd77 )
by Alexander
03:40
created
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.