Passed
Push — master ( 9013bb...125cf1 )
by Kirill
03:56
created
src/Http/tests/AcceptHeaderTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         $headers = $acceptHeader->getAll();
119 119
         $this->assertCount(count($expected), $headers);
120 120
 
121
-        foreach ($expected as $i => $value) {
121
+        foreach ($expected as $i => $value){
122 122
             $this->assertSame($value, $headers[$i]->getValue());
123 123
         }
124 124
     }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $headers = $acceptHeader->getAll();
165 165
         $this->assertCount(count($expected), $headers);
166 166
 
167
-        foreach ($expected as $i => $value) {
167
+        foreach ($expected as $i => $value){
168 168
             $this->assertSame($value, (string)$headers[$i]);
169 169
         }
170 170
     }
Please login to merge, or discard this patch.
src/Http/tests/HttpTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     {
45 45
         $core = $this->getCore();
46 46
 
47
-        $core->setHandler(function () {
47
+        $core->setHandler(function (){
48 48
             return 'hello world';
49 49
         });
50 50
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function testHandlerInterface(): void
74 74
     {
75 75
         $core = $this->getCore();
76
-        $core->setHandler(new CallableHandler(function () {
76
+        $core->setHandler(new CallableHandler(function (){
77 77
             return 'hello world';
78 78
         }, new ResponseFactory(new HttpConfig(['headers' => []]))));
79 79
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $core = $this->getCore();
87 87
 
88
-        $core->setHandler(function ($req, $resp) {
88
+        $core->setHandler(function ($req, $resp){
89 89
             return $resp->withAddedHeader('hello', 'value');
90 90
         });
91 91
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         $core = $this->getCore();
100 100
 
101
-        $core->setHandler(function ($req, $resp) {
101
+        $core->setHandler(function ($req, $resp){
102 102
             echo 'hello!';
103 103
 
104 104
             return $resp->withAddedHeader('hello', 'value');
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $core = $this->getCore();
116 116
 
117
-        $core->setHandler(function ($req, $resp) {
117
+        $core->setHandler(function ($req, $resp){
118 118
             echo 'hello!';
119 119
             $resp->getBody()->write('world ');
120 120
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $core = $this->getCore();
133 133
 
134
-        $core->setHandler(function () {
134
+        $core->setHandler(function (){
135 135
             ob_start();
136 136
             ob_start();
137 137
             echo 'hello!';
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     {
153 153
         $core = $this->getCore();
154 154
 
155
-        $core->setHandler(function () {
155
+        $core->setHandler(function (){
156 156
             return [
157 157
                 'status'  => 404,
158 158
                 'message' => 'not found',
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     {
169 169
         $core = $this->getCore();
170 170
 
171
-        $core->setHandler(function () {
171
+        $core->setHandler(function (){
172 172
             return new Json([
173 173
                 'status'  => 404,
174 174
                 'message' => 'not found',
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     {
185 185
         $core = $this->getCore([HeaderMiddleware::class]);
186 186
 
187
-        $core->setHandler(function () {
187
+        $core->setHandler(function (){
188 188
             return 'hello?';
189 189
         });
190 190
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         $core->getPipeline()->pushMiddleware(new Header2Middleware());
202 202
         $core->getPipeline()->riseMiddleware(new HeaderMiddleware());
203 203
 
204
-        $core->setHandler(function () {
204
+        $core->setHandler(function (){
205 205
             return 'hello?';
206 206
         });
207 207
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         $core->getPipeline()->pushMiddleware(new HeaderMiddleware());
219 219
         $core->getPipeline()->riseMiddleware(new Header2Middleware());
220 220
 
221
-        $core->setHandler(function () {
221
+        $core->setHandler(function (){
222 222
             return 'hello?';
223 223
         });
224 224
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     {
233 233
         $core = $this->getCore();
234 234
 
235
-        $core->setHandler(function () {
235
+        $core->setHandler(function (){
236 236
             $this->assertTrue($this->container->has(ServerRequestInterface::class));
237 237
 
238 238
             return 'OK';
Please login to merge, or discard this patch.
src/Http/tests/PipelineTest.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
         $pipeline = new Pipeline(new Container());
28 28
 
29
-        $handler = new CallableHandler(function () {
29
+        $handler = new CallableHandler(function (){
30 30
             return 'response';
31 31
         }, new ResponseFactory(new HttpConfig(['headers' => []])));
32 32
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $pipeline = new Pipeline(new Container());
43 43
 
44
-        $handler = new CallableHandler(function () {
44
+        $handler = new CallableHandler(function (){
45 45
             return 'response';
46 46
         }, new ResponseFactory(new HttpConfig(['headers' => []])));
47 47
 
Please login to merge, or discard this patch.
src/Http/tests/AcceptHeaderItemTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     public function emptyItemProvider(): iterable
34 34
     {
35 35
         $values = ['', ' '];
36
-        foreach ($values as $value) {
36
+        foreach ($values as $value){
37 37
             yield from [
38 38
                 [AcceptHeaderItem::fromString($value)],
39 39
                 [new AcceptHeaderItem($value)],
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function testItemQualityBoundaries(float $quality, AcceptHeaderItem $item): void
84 84
     {
85
-        if ($quality > 1) {
85
+        if ($quality > 1){
86 86
             $this->assertSame(1.0, $item->getQuality());
87 87
         }
88 88
 
89
-        if ($quality < 0) {
89
+        if ($quality < 0){
90 90
             $this->assertSame(0.0, $item->getQuality());
91 91
         }
92 92
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     public function qualityBoundariesProvider(): iterable
101 101
     {
102 102
         $qualities = [-1, 0, 0.5, 1, 2];
103
-        foreach ($qualities as $quality) {
103
+        foreach ($qualities as $quality){
104 104
             yield from [
105 105
                 [$quality, AcceptHeaderItem::fromString("*;q=$quality")],
106 106
                 [$quality, AcceptHeaderItem::fromString("*;Q=$quality")],
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
             ]
141 141
         ];
142 142
 
143
-        foreach ($set as $params) {
143
+        foreach ($set as $params){
144 144
             $formattedParams = [];
145
-            foreach ($params['passed'] as $k => $v) {
145
+            foreach ($params['passed'] as $k => $v){
146 146
                 $formattedParams[] = "$k=$v";
147 147
             }
148 148
 
Please login to merge, or discard this patch.
src/Http/tests/Diactoros/UploadedFileFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         string $clientFilename = null,
27 27
         string $clientMediaType = null
28 28
     ): UploadedFileInterface {
29
-        if ($size === null) {
29
+        if ($size === null){
30 30
             $size = $stream->getSize();
31 31
         }
32 32
 
Please login to merge, or discard this patch.
src/Http/tests/Diactoros/ResponseFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         $response = new Response('php://memory', $code, []);
38 38
         $response = $response->withStatus($code, $reasonPhrase);
39 39
 
40
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
40
+        foreach ($this->config->getBaseHeaders() as $header => $value){
41 41
             $response = $response->withAddedHeader($header, $value);
42 42
         }
43 43
 
Please login to merge, or discard this patch.
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 1 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.
src/Http/src/Http.php 1 patch
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.