Completed
Push — master ( 6366df...fbe022 )
by Kirill
23s queued 19s
created
src/Http/tests/ServerTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $this->container->bind(ServerRequestInterface::class, $request);
165 165
 
166 166
         $this->assertSame(
167
-            ['PATH' => 'sample',],
167
+            ['PATH' => 'sample', ],
168 168
             $this->input->server->__debugInfo()
169 169
         );
170 170
     }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         $this->container->bind(ServerRequestInterface::class, $request);
179 179
 
180 180
         $this->assertSame(
181
-            ['PATH' => 'sample',],
181
+            ['PATH' => 'sample', ],
182 182
             iterator_to_array($this->input->server)
183 183
         );
184 184
     }
Please login to merge, or discard this patch.
src/Http/src/CallableHandler.php 3 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,6 @@
 block discarded – undo
75 75
      * @param Response $response Initial pipeline response.
76 76
      * @param mixed    $result   Generated endpoint output.
77 77
      * @param string   $output   Buffer output.
78
-
79 78
      * @return Response
80 79
      */
81 80
     private function wrapResponse(Response $response, $result = null, string $output = ''): Response
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
         $output = $result = null;
52 52
 
53 53
         $response = $this->responseFactory->createResponse(200);
54
-        try {
54
+        try{
55 55
             $result = ($this->callable)($request, $response);
56
-        } catch (\Throwable $e) {
56
+        }catch (\Throwable $e){
57 57
             ob_get_clean();
58 58
             throw $e;
59
-        } finally {
60
-            while (ob_get_level() > $outputLevel + 1) {
61
-                $output = ob_get_clean() . $output;
59
+        }finally{
60
+            while (ob_get_level() > $outputLevel + 1){
61
+                $output = ob_get_clean().$output;
62 62
             }
63 63
         }
64 64
 
65 65
         return $this->wrapResponse(
66 66
             $response,
67 67
             $result,
68
-            ob_get_clean() . $output
68
+            ob_get_clean().$output
69 69
         );
70 70
     }
71 71
 
@@ -80,17 +80,17 @@  discard block
 block discarded – undo
80 80
      */
81 81
     private function wrapResponse(Response $response, $result = null, string $output = ''): Response
82 82
     {
83
-        if ($result instanceof Response) {
84
-            if (!empty($output) && $result->getBody()->isWritable()) {
83
+        if ($result instanceof Response){
84
+            if (!empty($output) && $result->getBody()->isWritable()){
85 85
                 $result->getBody()->write($output);
86 86
             }
87 87
 
88 88
             return $result;
89 89
         }
90 90
 
91
-        if (is_array($result) || $result instanceof \JsonSerializable) {
91
+        if (is_array($result) || $result instanceof \JsonSerializable){
92 92
             $response = $this->writeJson($response, $result);
93
-        } else {
93
+        }else{
94 94
             $response->getBody()->write((string)$result);
95 95
         }
96 96
 
Please login to merge, or discard this patch.
Braces   +19 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,13 +51,19 @@  discard block
 block discarded – undo
51 51
         $output = $result = null;
52 52
 
53 53
         $response = $this->responseFactory->createResponse(200);
54
-        try {
54
+        try
55
+        {
55 56
             $result = ($this->callable)($request, $response);
56
-        } catch (\Throwable $e) {
57
+        }
58
+        catch (\Throwable $e)
59
+        {
57 60
             ob_get_clean();
58 61
             throw $e;
59
-        } finally {
60
-            while (ob_get_level() > $outputLevel + 1) {
62
+        }
63
+        finally
64
+        {
65
+            while (ob_get_level() > $outputLevel + 1)
66
+            {
61 67
                 $output = ob_get_clean() . $output;
62 68
             }
63 69
         }
@@ -80,17 +86,22 @@  discard block
 block discarded – undo
80 86
      */
81 87
     private function wrapResponse(Response $response, $result = null, string $output = ''): Response
82 88
     {
83
-        if ($result instanceof Response) {
84
-            if (!empty($output) && $result->getBody()->isWritable()) {
89
+        if ($result instanceof Response)
90
+        {
91
+            if (!empty($output) && $result->getBody()->isWritable())
92
+            {
85 93
                 $result->getBody()->write($output);
86 94
             }
87 95
 
88 96
             return $result;
89 97
         }
90 98
 
91
-        if (is_array($result) || $result instanceof \JsonSerializable) {
99
+        if (is_array($result) || $result instanceof \JsonSerializable)
100
+        {
92 101
             $response = $this->writeJson($response, $result);
93
-        } else {
102
+        }
103
+        else
104
+        {
94 105
             $response->getBody()->write((string)$result);
95 106
         }
96 107
 
Please login to merge, or discard this patch.
src/Http/src/Http.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
         Pipeline $pipeline,
48 48
         ResponseFactoryInterface $responseFactory,
49 49
         ContainerInterface $container
50
-    ) {
50
+    ){
51 51
         $this->config = $config;
52 52
         $this->pipeline = $pipeline;
53 53
         $this->responseFactory = $responseFactory;
54 54
         $this->container = $container;
55 55
 
56
-        foreach ($this->config->getMiddleware() as $middleware) {
56
+        foreach ($this->config->getMiddleware() as $middleware){
57 57
             $this->pipeline->pushMiddleware($this->container->get($middleware));
58 58
         }
59 59
     }
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function setHandler($handler): self
74 74
     {
75
-        if ($handler instanceof RequestHandlerInterface) {
75
+        if ($handler instanceof RequestHandlerInterface){
76 76
             $this->handler = $handler;
77
-        } elseif (is_callable($handler)) {
77
+        } elseif (is_callable($handler)){
78 78
             $this->handler = new CallableHandler($handler, $this->responseFactory);
79
-        } else {
79
+        }else{
80 80
             throw new HttpException(
81 81
                 'Invalid handler is given, expects callable or RequestHandlerInterface.'
82 82
             );
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function handle(ServerRequestInterface $request): ResponseInterface
95 95
     {
96
-        if (empty($this->handler)) {
96
+        if (empty($this->handler)){
97 97
             throw new HttpException('Unable to run HttpCore, no handler is set.');
98 98
         }
99 99
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,8 @@  discard block
 block discarded – undo
53 53
         $this->responseFactory = $responseFactory;
54 54
         $this->container = $container;
55 55
 
56
-        foreach ($this->config->getMiddleware() as $middleware) {
56
+        foreach ($this->config->getMiddleware() as $middleware)
57
+        {
57 58
             $this->pipeline->pushMiddleware($this->container->get($middleware));
58 59
         }
59 60
     }
@@ -72,11 +73,16 @@  discard block
 block discarded – undo
72 73
      */
73 74
     public function setHandler($handler): self
74 75
     {
75
-        if ($handler instanceof RequestHandlerInterface) {
76
+        if ($handler instanceof RequestHandlerInterface)
77
+        {
76 78
             $this->handler = $handler;
77
-        } elseif (is_callable($handler)) {
79
+        }
80
+        elseif (is_callable($handler))
81
+        {
78 82
             $this->handler = new CallableHandler($handler, $this->responseFactory);
79
-        } else {
83
+        }
84
+        else
85
+        {
80 86
             throw new HttpException(
81 87
                 'Invalid handler is given, expects callable or RequestHandlerInterface.'
82 88
             );
@@ -93,7 +99,8 @@  discard block
 block discarded – undo
93 99
      */
94 100
     public function handle(ServerRequestInterface $request): ResponseInterface
95 101
     {
96
-        if (empty($this->handler)) {
102
+        if (empty($this->handler))
103
+        {
97 104
             throw new HttpException('Unable to run HttpCore, no handler is set.');
98 105
         }
99 106
 
Please login to merge, or discard this patch.
src/Http/src/Header/AcceptHeader.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function __construct(array $items = [])
38 38
     {
39
-        foreach ($items as $item) {
39
+        foreach ($items as $item){
40 40
             $this->addItem($item);
41 41
         }
42 42
     }
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
         $header = new static();
59 59
 
60 60
         $parts = explode(',', $raw);
61
-        foreach ($parts as $part) {
61
+        foreach ($parts as $part){
62 62
             $part = trim($part);
63
-            if ($part !== '') {
63
+            if ($part !== ''){
64 64
                 $header->addItem($part);
65 65
             }
66 66
         }
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function getAll(): array
105 105
     {
106
-        if (!$this->sorted) {
106
+        if (!$this->sorted){
107 107
             /**
108 108
              * Sort item in descending order.
109 109
              */
110
-            uasort($this->items, static function (AcceptHeaderItem $a, AcceptHeaderItem $b) {
110
+            uasort($this->items, static function (AcceptHeaderItem $a, AcceptHeaderItem $b){
111 111
                 return self::compare($a, $b) * -1;
112 112
             });
113 113
 
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
      */
125 125
     private function addItem($item): void
126 126
     {
127
-        if (is_scalar($item)) {
127
+        if (is_scalar($item)){
128 128
             $item = AcceptHeaderItem::fromString((string)$item);
129 129
         }
130 130
 
131
-        if (!$item instanceof AcceptHeaderItem) {
131
+        if (!$item instanceof AcceptHeaderItem){
132 132
             throw new AcceptHeaderException(sprintf(
133 133
                 'Accept Header item expected to be an instance of `%s` or a string, got `%s`',
134 134
                 AcceptHeaderItem::class,
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         }
138 138
 
139 139
         $value = strtolower($item->getValue());
140
-        if ($value !== '' && (!$this->has($value) || self::compare($item, $this->get($value)) === 1)) {
140
+        if ($value !== '' && (!$this->has($value) || self::compare($item, $this->get($value)) === 1)){
141 141
             $this->sorted = false;
142 142
             $this->items[$value] = $item;
143 143
         }
@@ -153,9 +153,9 @@  discard block
 block discarded – undo
153 153
      */
154 154
     private static function compare(AcceptHeaderItem $a, AcceptHeaderItem $b): int
155 155
     {
156
-        if ($a->getQuality() === $b->getQuality()) {
156
+        if ($a->getQuality() === $b->getQuality()){
157 157
             // If quality are same value with more params has more weight.
158
-            if (count($a->getParams()) === count($b->getParams())) {
158
+            if (count($a->getParams()) === count($b->getParams())){
159 159
                 // If quality and params then check for specific type or subtype.
160 160
                 // Means */* or * has less weight.
161 161
                 return static::compareValue($a->getValue(), $b->getValue());
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
     private static function compareValue(string $a, string $b): int
179 179
     {
180 180
         // Check "Accept" headers values with it is type and subtype.
181
-        if (strpos($a, '/') !== false && strpos($b, '/') !== false) {
181
+        if (strpos($a, '/') !== false && strpos($b, '/') !== false){
182 182
             [$typeA, $subtypeA] = explode('/', $a, 2);
183 183
             [$typeB, $subtypeB] = explode('/', $b, 2);
184 184
 
185
-            if ($typeA === $typeB) {
185
+            if ($typeA === $typeB){
186 186
                 return static::compareAtomic($subtypeA, $subtypeB);
187 187
             }
188 188
 
@@ -199,23 +199,23 @@  discard block
 block discarded – undo
199 199
      */
200 200
     private static function compareAtomic(string $a, string $b): int
201 201
     {
202
-        if (mb_strpos($a, '*/') === 0) {
202
+        if (mb_strpos($a, '*/') === 0){
203 203
             $a = '*';
204 204
         }
205 205
 
206
-        if (mb_strpos($b, '*/') === 0) {
206
+        if (mb_strpos($b, '*/') === 0){
207 207
             $b = '*';
208 208
         }
209 209
 
210
-        if (strtolower($a) === strtolower($b)) {
210
+        if (strtolower($a) === strtolower($b)){
211 211
             return 0;
212 212
         }
213 213
 
214
-        if ($a === '*') {
214
+        if ($a === '*'){
215 215
             return -1;
216 216
         }
217 217
 
218
-        if ($b === '*') {
218
+        if ($b === '*'){
219 219
             return 1;
220 220
         }
221 221
 
Please login to merge, or discard this patch.
Braces   +34 added lines, -17 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function __construct(array $items = [])
38 38
     {
39
-        foreach ($items as $item) {
39
+        foreach ($items as $item)
40
+        {
40 41
             $this->addItem($item);
41 42
         }
42 43
     }
@@ -58,9 +59,11 @@  discard block
 block discarded – undo
58 59
         $header = new static();
59 60
 
60 61
         $parts = explode(',', $raw);
61
-        foreach ($parts as $part) {
62
+        foreach ($parts as $part)
63
+        {
62 64
             $part = trim($part);
63
-            if ($part !== '') {
65
+            if ($part !== '')
66
+            {
64 67
                 $header->addItem($part);
65 68
             }
66 69
         }
@@ -103,11 +106,13 @@  discard block
 block discarded – undo
103 106
      */
104 107
     public function getAll(): array
105 108
     {
106
-        if (!$this->sorted) {
109
+        if (!$this->sorted)
110
+        {
107 111
             /**
108 112
              * Sort item in descending order.
109 113
              */
110
-            uasort($this->items, static function (AcceptHeaderItem $a, AcceptHeaderItem $b) {
114
+            uasort($this->items, static function (AcceptHeaderItem $a, AcceptHeaderItem $b)
115
+            {
111 116
                 return self::compare($a, $b) * -1;
112 117
             });
113 118
 
@@ -124,11 +129,13 @@  discard block
 block discarded – undo
124 129
      */
125 130
     private function addItem($item): void
126 131
     {
127
-        if (is_scalar($item)) {
132
+        if (is_scalar($item))
133
+        {
128 134
             $item = AcceptHeaderItem::fromString((string)$item);
129 135
         }
130 136
 
131
-        if (!$item instanceof AcceptHeaderItem) {
137
+        if (!$item instanceof AcceptHeaderItem)
138
+        {
132 139
             throw new AcceptHeaderException(sprintf(
133 140
                 'Accept Header item expected to be an instance of `%s` or a string, got `%s`',
134 141
                 AcceptHeaderItem::class,
@@ -137,7 +144,8 @@  discard block
 block discarded – undo
137 144
         }
138 145
 
139 146
         $value = strtolower($item->getValue());
140
-        if ($value !== '' && (!$this->has($value) || self::compare($item, $this->get($value)) === 1)) {
147
+        if ($value !== '' && (!$this->has($value) || self::compare($item, $this->get($value)) === 1))
148
+        {
141 149
             $this->sorted = false;
142 150
             $this->items[$value] = $item;
143 151
         }
@@ -153,9 +161,11 @@  discard block
 block discarded – undo
153 161
      */
154 162
     private static function compare(AcceptHeaderItem $a, AcceptHeaderItem $b): int
155 163
     {
156
-        if ($a->getQuality() === $b->getQuality()) {
164
+        if ($a->getQuality() === $b->getQuality())
165
+        {
157 166
             // If quality are same value with more params has more weight.
158
-            if (count($a->getParams()) === count($b->getParams())) {
167
+            if (count($a->getParams()) === count($b->getParams()))
168
+            {
159 169
                 // If quality and params then check for specific type or subtype.
160 170
                 // Means */* or * has less weight.
161 171
                 return static::compareValue($a->getValue(), $b->getValue());
@@ -178,11 +188,13 @@  discard block
 block discarded – undo
178 188
     private static function compareValue(string $a, string $b): int
179 189
     {
180 190
         // Check "Accept" headers values with it is type and subtype.
181
-        if (strpos($a, '/') !== false && strpos($b, '/') !== false) {
191
+        if (strpos($a, '/') !== false && strpos($b, '/') !== false)
192
+        {
182 193
             [$typeA, $subtypeA] = explode('/', $a, 2);
183 194
             [$typeB, $subtypeB] = explode('/', $b, 2);
184 195
 
185
-            if ($typeA === $typeB) {
196
+            if ($typeA === $typeB)
197
+            {
186 198
                 return static::compareAtomic($subtypeA, $subtypeB);
187 199
             }
188 200
 
@@ -199,23 +211,28 @@  discard block
 block discarded – undo
199 211
      */
200 212
     private static function compareAtomic(string $a, string $b): int
201 213
     {
202
-        if (mb_strpos($a, '*/') === 0) {
214
+        if (mb_strpos($a, '*/') === 0)
215
+        {
203 216
             $a = '*';
204 217
         }
205 218
 
206
-        if (mb_strpos($b, '*/') === 0) {
219
+        if (mb_strpos($b, '*/') === 0)
220
+        {
207 221
             $b = '*';
208 222
         }
209 223
 
210
-        if (strtolower($a) === strtolower($b)) {
224
+        if (strtolower($a) === strtolower($b))
225
+        {
211 226
             return 0;
212 227
         }
213 228
 
214
-        if ($a === '*') {
229
+        if ($a === '*')
230
+        {
215 231
             return -1;
216 232
         }
217 233
 
218
-        if ($b === '*') {
234
+        if ($b === '*')
235
+        {
219 236
             return 1;
220 237
         }
221 238
 
Please login to merge, or discard this patch.
src/Http/src/Header/AcceptHeaderItem.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function __toString(): string
47 47
     {
48
-        if ($this->value === '') {
48
+        if ($this->value === ''){
49 49
             return '';
50 50
         }
51 51
 
52 52
         $parts = [$this->value];
53 53
 
54
-        if ($this->quality < 1) {
54
+        if ($this->quality < 1){
55 55
             $parts[] = "q=$this->quality";
56 56
         }
57 57
 
58
-        foreach ($this->getParams() as $name => $value) {
58
+        foreach ($this->getParams() as $name => $value){
59 59
             $parts[] = "$name=$value";
60 60
         }
61 61
 
@@ -76,20 +76,20 @@  discard block
 block discarded – undo
76 76
         $quality = 1.0;
77 77
         $params = [];
78 78
 
79
-        foreach ($elements as $element) {
79
+        foreach ($elements as $element){
80 80
             $parsed = explode('=', trim($element), 2);
81 81
 
82 82
             // Wrong params must be ignored
83
-            if (count($parsed) !== 2) {
83
+            if (count($parsed) !== 2){
84 84
                 continue;
85 85
             }
86 86
 
87 87
             $name = trim($parsed[0]);
88 88
             $value = trim($parsed[1]);
89 89
 
90
-            if (strcasecmp($name, 'q') === 0) {
90
+            if (strcasecmp($name, 'q') === 0){
91 91
                 $quality = (float)$value;
92
-            } else {
92
+            }else{
93 93
                 $params[$name] = $value;
94 94
             }
95 95
         }
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
      */
179 179
     private function setParams(array $params): void
180 180
     {
181
-        foreach ($params as $name => $value) {
182
-            if (is_numeric($name) || !is_scalar($value)) {
181
+        foreach ($params as $name => $value){
182
+            if (is_numeric($name) || !is_scalar($value)){
183 183
                 continue;
184 184
             }
185 185
 
186 186
             $name = trim($name);
187 187
             $value = trim($value);
188 188
 
189
-            if ($name === '' || $value === '') {
189
+            if ($name === '' || $value === ''){
190 190
                 continue;
191 191
             }
192 192
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,17 +45,20 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function __toString(): string
47 47
     {
48
-        if ($this->value === '') {
48
+        if ($this->value === '')
49
+        {
49 50
             return '';
50 51
         }
51 52
 
52 53
         $parts = [$this->value];
53 54
 
54
-        if ($this->quality < 1) {
55
+        if ($this->quality < 1)
56
+        {
55 57
             $parts[] = "q=$this->quality";
56 58
         }
57 59
 
58
-        foreach ($this->getParams() as $name => $value) {
60
+        foreach ($this->getParams() as $name => $value)
61
+        {
59 62
             $parts[] = "$name=$value";
60 63
         }
61 64
 
@@ -76,20 +79,25 @@  discard block
 block discarded – undo
76 79
         $quality = 1.0;
77 80
         $params = [];
78 81
 
79
-        foreach ($elements as $element) {
82
+        foreach ($elements as $element)
83
+        {
80 84
             $parsed = explode('=', trim($element), 2);
81 85
 
82 86
             // Wrong params must be ignored
83
-            if (count($parsed) !== 2) {
87
+            if (count($parsed) !== 2)
88
+            {
84 89
                 continue;
85 90
             }
86 91
 
87 92
             $name = trim($parsed[0]);
88 93
             $value = trim($parsed[1]);
89 94
 
90
-            if (strcasecmp($name, 'q') === 0) {
95
+            if (strcasecmp($name, 'q') === 0)
96
+            {
91 97
                 $quality = (float)$value;
92
-            } else {
98
+            }
99
+            else
100
+            {
93 101
                 $params[$name] = $value;
94 102
             }
95 103
         }
@@ -178,15 +186,18 @@  discard block
 block discarded – undo
178 186
      */
179 187
     private function setParams(array $params): void
180 188
     {
181
-        foreach ($params as $name => $value) {
182
-            if (is_numeric($name) || !is_scalar($value)) {
189
+        foreach ($params as $name => $value)
190
+        {
191
+            if (is_numeric($name) || !is_scalar($value))
192
+            {
183 193
                 continue;
184 194
             }
185 195
 
186 196
             $name = trim($name);
187 197
             $value = trim($value);
188 198
 
189
-            if ($name === '' || $value === '') {
199
+            if ($name === '' || $value === '')
200
+            {
190 201
                 continue;
191 202
             }
192 203
 
Please login to merge, or discard this patch.
src/Http/src/Traits/JsonTrait.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@
 block discarded – undo
29 29
      */
30 30
     private function writeJson(ResponseInterface $response, $payload, int $code = 200): ResponseInterface
31 31
     {
32
-        if ($payload instanceof JsonSerializable) {
32
+        if ($payload instanceof JsonSerializable){
33 33
             $payload = $payload->jsonSerialize();
34 34
         }
35 35
 
36
-        if (is_array($payload) && isset($payload['status'])) {
36
+        if (is_array($payload) && isset($payload['status'])){
37 37
             $code = $payload['status'];
38 38
         }
39 39
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,11 +29,13 @@
 block discarded – undo
29 29
      */
30 30
     private function writeJson(ResponseInterface $response, $payload, int $code = 200): ResponseInterface
31 31
     {
32
-        if ($payload instanceof JsonSerializable) {
32
+        if ($payload instanceof JsonSerializable)
33
+        {
33 34
             $payload = $payload->jsonSerialize();
34 35
         }
35 36
 
36
-        if (is_array($payload) && isset($payload['status'])) {
37
+        if (is_array($payload) && isset($payload['status']))
38
+        {
37 39
             $code = $payload['status'];
38 40
         }
39 41
 
Please login to merge, or discard this patch.
src/Http/src/Emitter/SapiEmitter.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
      */
68 68
     private function assertNoPreviousOutput(): void
69 69
     {
70
-        if (headers_sent()) {
70
+        if (headers_sent()){
71 71
             throw new EmitterException('Unable to emit response, headers already send.');
72 72
         }
73 73
 
74
-        if (ob_get_level() > 0 && ob_get_length() > 0) {
74
+        if (ob_get_level() > 0 && ob_get_length() > 0){
75 75
             throw new EmitterException('Unable to emit response, found non closed buffered output.');
76 76
         }
77 77
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             'HTTP/%s %d%s',
98 98
             $response->getProtocolVersion(),
99 99
             $statusCode,
100
-            ($reasonPhrase ? ' ' . $reasonPhrase : '')
100
+            ($reasonPhrase ? ' '.$reasonPhrase : '')
101 101
         ), true, $statusCode);
102 102
     }
103 103
 
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $statusCode = $response->getStatusCode();
117 117
 
118
-        foreach ($response->getHeaders() as $header => $values) {
118
+        foreach ($response->getHeaders() as $header => $values){
119 119
             $name = $this->filterHeader($header);
120 120
             $first = $name === 'Set-Cookie' ? false : true;
121
-            foreach ($values as $value) {
121
+            foreach ($values as $value){
122 122
                 header(sprintf(
123 123
                     '%s: %s',
124 124
                     $name,
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,11 +67,13 @@  discard block
 block discarded – undo
67 67
      */
68 68
     private function assertNoPreviousOutput(): void
69 69
     {
70
-        if (headers_sent()) {
70
+        if (headers_sent())
71
+        {
71 72
             throw new EmitterException('Unable to emit response, headers already send.');
72 73
         }
73 74
 
74
-        if (ob_get_level() > 0 && ob_get_length() > 0) {
75
+        if (ob_get_level() > 0 && ob_get_length() > 0)
76
+        {
75 77
             throw new EmitterException('Unable to emit response, found non closed buffered output.');
76 78
         }
77 79
     }
@@ -115,10 +117,12 @@  discard block
 block discarded – undo
115 117
     {
116 118
         $statusCode = $response->getStatusCode();
117 119
 
118
-        foreach ($response->getHeaders() as $header => $values) {
120
+        foreach ($response->getHeaders() as $header => $values)
121
+        {
119 122
             $name = $this->filterHeader($header);
120 123
             $first = $name === 'Set-Cookie' ? false : true;
121
-            foreach ($values as $value) {
124
+            foreach ($values as $value)
125
+            {
122 126
                 header(sprintf(
123 127
                     '%s: %s',
124 128
                     $name,
Please login to merge, or discard this patch.
src/Http/src/Pipeline.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,12 +73,12 @@
 block discarded – undo
73 73
      */
74 74
     public function handle(Request $request): Response
75 75
     {
76
-        if (empty($this->handler)) {
76
+        if (empty($this->handler)){
77 77
             throw new PipelineException('Unable to run pipeline, no handler given.');
78 78
         }
79 79
 
80 80
         $position = $this->position++;
81
-        if (isset($this->middleware[$position])) {
81
+        if (isset($this->middleware[$position])){
82 82
             return $this->middleware[$position]->process($request, $this);
83 83
         }
84 84
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,16 +73,19 @@
 block discarded – undo
73 73
      */
74 74
     public function handle(Request $request): Response
75 75
     {
76
-        if (empty($this->handler)) {
76
+        if (empty($this->handler))
77
+        {
77 78
             throw new PipelineException('Unable to run pipeline, no handler given.');
78 79
         }
79 80
 
80 81
         $position = $this->position++;
81
-        if (isset($this->middleware[$position])) {
82
+        if (isset($this->middleware[$position]))
83
+        {
82 84
             return $this->middleware[$position]->process($request, $this);
83 85
         }
84 86
 
85
-        return $this->scope->runScope([Request::class => $request], function () use ($request) {
87
+        return $this->scope->runScope([Request::class => $request], function () use ($request)
88
+        {
86 89
             return $this->handler->handle($request);
87 90
         });
88 91
     }
Please login to merge, or discard this patch.
src/Http/src/Exception/ClientException.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@
 block discarded – undo
34 34
      */
35 35
     public function __construct(?int $code = null, string $message = '', ?\Throwable $previous = null)
36 36
     {
37
-        if (empty($code) && empty($this->code)) {
37
+        if (empty($code) && empty($this->code)){
38 38
             $code = self::BAD_DATA;
39 39
         }
40 40
 
41
-        if (empty($message)) {
41
+        if (empty($message)){
42 42
             $message = "Http Error - {$code}";
43 43
         }
44 44
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,11 +34,13 @@
 block discarded – undo
34 34
      */
35 35
     public function __construct(?int $code = null, string $message = '', ?\Throwable $previous = null)
36 36
     {
37
-        if (empty($code) && empty($this->code)) {
37
+        if (empty($code) && empty($this->code))
38
+        {
38 39
             $code = self::BAD_DATA;
39 40
         }
40 41
 
41
-        if (empty($message)) {
42
+        if (empty($message))
43
+        {
42 44
             $message = "Http Error - {$code}";
43 45
         }
44 46
 
Please login to merge, or discard this patch.