Passed
Push — master ( f834b5...c762fc )
by Aleksei
06:53 queued 20s
created
src/Http/src/Http.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,8 @@  discard block
 block discarded – undo
34 34
         ?TracerFactoryInterface $tracerFactory = null,
35 35
         private readonly ?EventDispatcherInterface $dispatcher = null,
36 36
     ) {
37
-        foreach ($this->config->getMiddleware() as $middleware) {
37
+        foreach ($this->config->getMiddleware() as $middleware)
38
+        {
38 39
             $this->pipeline->pushMiddleware($this->container->get($middleware));
39 40
         }
40 41
 
@@ -66,7 +67,8 @@  discard block
 block discarded – undo
66 67
 
67 68
             $this->dispatcher?->dispatch(new RequestReceived($request));
68 69
 
69
-            if ($this->handler === null) {
70
+            if ($this->handler === null)
71
+            {
70 72
                 throw new HttpException('Unable to run HttpCore, no handler is set.');
71 73
             }
72 74
 
@@ -103,7 +105,8 @@  discard block
 block discarded – undo
103 105
             traceKind: TraceKind::SERVER,
104 106
         );
105 107
 
106
-        foreach ($tracer->getContext() as $key => $value) {
108
+        foreach ($tracer->getContext() as $key => $value)
109
+        {
107 110
             $response = $response->withHeader($key, $value);
108 111
         }
109 112
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
         private readonly ContainerInterface $container,
34 34
         ?TracerFactoryInterface $tracerFactory = null,
35 35
         private readonly ?EventDispatcherInterface $dispatcher = null,
36
-    ) {
37
-        foreach ($this->config->getMiddleware() as $middleware) {
36
+    ){
37
+        foreach ($this->config->getMiddleware() as $middleware){
38 38
             $this->pipeline->pushMiddleware($this->container->get($middleware));
39 39
         }
40 40
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         return $this->pipeline;
48 48
     }
49 49
 
50
-    public function setHandler(callable|RequestHandlerInterface $handler): self
50
+    public function setHandler(callable | RequestHandlerInterface $handler): self
51 51
     {
52 52
         $this->handler = $handler instanceof RequestHandlerInterface
53 53
             ? $handler
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
             $this->dispatcher?->dispatch(new RequestReceived($request));
68 68
 
69
-            if ($this->handler === null) {
69
+            if ($this->handler === null){
70 70
                 throw new HttpException('Unable to run HttpCore, no handler is set.');
71 71
             }
72 72
 
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
             callback: $callback,
97 97
             attributes: [
98 98
                 'http.method' => $request->getMethod(),
99
-                'http.url' => (string) $request->getUri(),
99
+                'http.url' => (string)$request->getUri(),
100 100
                 'http.headers' => $request->getHeaders(),
101 101
             ],
102 102
             scoped: true,
103 103
             traceKind: TraceKind::SERVER,
104 104
         );
105 105
 
106
-        foreach ($tracer->getContext() as $key => $value) {
106
+        foreach ($tracer->getContext() as $key => $value){
107 107
             $response = $response->withHeader($key, $value);
108 108
         }
109 109
 
Please login to merge, or discard this patch.
src/Http/tests/HttpTest.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     {
48 48
         $core = $this->getCore();
49 49
 
50
-        $core->setHandler(function () {
50
+        $core->setHandler(function (){
51 51
             return 'hello world';
52 52
         });
53 53
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $core = $this->getCore();
71 71
         $core->setHandler(
72
-            new CallableHandler(function () {
72
+            new CallableHandler(function (){
73 73
                 return 'hello world';
74 74
             }, new ResponseFactory(new HttpConfig(['headers' => []])))
75 75
         );
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $core = $this->getCore();
84 84
 
85
-        $core->setHandler(function ($req, $resp) {
85
+        $core->setHandler(function ($req, $resp){
86 86
             return $resp->withAddedHeader('hello', 'value');
87 87
         });
88 88
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     {
96 96
         $core = $this->getCore();
97 97
 
98
-        $core->setHandler(function ($req, $resp) {
98
+        $core->setHandler(function ($req, $resp){
99 99
             echo 'hello!';
100 100
 
101 101
             return $resp->withAddedHeader('hello', 'value');
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $core = $this->getCore();
113 113
 
114
-        $core->setHandler(function ($req, $resp) {
114
+        $core->setHandler(function ($req, $resp){
115 115
             echo 'hello!';
116 116
             $resp->getBody()->write('world ');
117 117
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     {
129 129
         $core = $this->getCore();
130 130
 
131
-        $core->setHandler(function () {
131
+        $core->setHandler(function (){
132 132
             ob_start();
133 133
             ob_start();
134 134
             echo 'hello!';
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     {
150 150
         $core = $this->getCore();
151 151
 
152
-        $core->setHandler(function () {
152
+        $core->setHandler(function (){
153 153
             return [
154 154
                 'status' => 404,
155 155
                 'message' => 'not found',
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     {
166 166
         $core = $this->getCore();
167 167
 
168
-        $core->setHandler(function () {
168
+        $core->setHandler(function (){
169 169
             return new Json([
170 170
                 'status' => 404,
171 171
                 'message' => 'not found',
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     {
182 182
         $core = $this->getCore([HeaderMiddleware::class]);
183 183
 
184
-        $core->setHandler(function () {
184
+        $core->setHandler(function (){
185 185
             return 'hello?';
186 186
         });
187 187
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $core->getPipeline()->pushMiddleware(new Header2Middleware());
199 199
         $core->getPipeline()->riseMiddleware(new HeaderMiddleware());
200 200
 
201
-        $core->setHandler(function () {
201
+        $core->setHandler(function (){
202 202
             return 'hello?';
203 203
         });
204 204
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $core->getPipeline()->pushMiddleware(new HeaderMiddleware());
216 216
         $core->getPipeline()->riseMiddleware(new Header2Middleware());
217 217
 
218
-        $core->setHandler(function () {
218
+        $core->setHandler(function (){
219 219
             return 'hello?';
220 220
         });
221 221
 
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
         $dispatcher
249 249
             ->expects(self::exactly(2))
250 250
             ->method('dispatch')
251
-            ->with($this->callback(static fn(RequestReceived|RequestHandled $event): bool => true));
251
+            ->with($this->callback(static fn(RequestReceived | RequestHandled $event): bool => true));
252 252
         $this->container->bind(EventDispatcherInterface::class, $dispatcher);
253 253
 
254 254
         $core = $this->getCore();
255 255
 
256
-        $core->setHandler(function () {
256
+        $core->setHandler(function (){
257 257
             return 'hello world';
258 258
         });
259 259
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
             $tracerFactory = m::mock(TracerFactoryInterface::class),
275 275
         );
276 276
 
277
-        $http->setHandler(function () {
277
+        $http->setHandler(function (){
278 278
             return 'hello world';
279 279
         });
280 280
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
                 TraceKind::SERVER,
310 310
             )
311 311
             ->willReturnCallback(
312
-                function ($name, $callback, $attributes, $scoped, $traceKind) {
312
+                function ($name, $callback, $attributes, $scoped, $traceKind){
313 313
                     self::assertSame($attributes, [
314 314
                         'http.method' => 'GET',
315 315
                         'http.url' => 'http://example.org/path',
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
             $tracerFactory,
340 340
         );
341 341
 
342
-        $http->setHandler(function () {
342
+        $http->setHandler(function (){
343 343
             return 'hello world';
344 344
         });
345 345
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
             $tracerFactory = m::mock(TracerFactoryInterface::class),
361 361
         );
362 362
 
363
-        $http->setHandler(function () {
363
+        $http->setHandler(function (){
364 364
             return 'hello world';
365 365
         });
366 366
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         $tracer
373 373
             ->shouldReceive('trace')
374 374
             ->once()
375
-            ->andReturnUsing(function($name, $callback, $attributes, $scoped, $traceKind) {
375
+            ->andReturnUsing(function ($name, $callback, $attributes, $scoped, $traceKind){
376 376
                 return $this->container->get(TracerInterface::class)->trace($name, $callback, $attributes, $scoped, $traceKind);
377 377
             });
378 378
 
Please login to merge, or discard this patch.
Braces   +34 added lines, -17 removed lines patch added patch discarded remove patch
@@ -47,7 +47,8 @@  discard block
 block discarded – undo
47 47
     {
48 48
         $core = $this->getCore();
49 49
 
50
-        $core->setHandler(function () {
50
+        $core->setHandler(function ()
51
+        {
51 52
             return 'hello world';
52 53
         });
53 54
 
@@ -69,7 +70,8 @@  discard block
 block discarded – undo
69 70
     {
70 71
         $core = $this->getCore();
71 72
         $core->setHandler(
72
-            new CallableHandler(function () {
73
+            new CallableHandler(function ()
74
+            {
73 75
                 return 'hello world';
74 76
             }, new ResponseFactory(new HttpConfig(['headers' => []])))
75 77
         );
@@ -82,7 +84,8 @@  discard block
 block discarded – undo
82 84
     {
83 85
         $core = $this->getCore();
84 86
 
85
-        $core->setHandler(function ($req, $resp) {
87
+        $core->setHandler(function ($req, $resp)
88
+        {
86 89
             return $resp->withAddedHeader('hello', 'value');
87 90
         });
88 91
 
@@ -95,7 +98,8 @@  discard block
 block discarded – undo
95 98
     {
96 99
         $core = $this->getCore();
97 100
 
98
-        $core->setHandler(function ($req, $resp) {
101
+        $core->setHandler(function ($req, $resp)
102
+        {
99 103
             echo 'hello!';
100 104
 
101 105
             return $resp->withAddedHeader('hello', 'value');
@@ -111,7 +115,8 @@  discard block
 block discarded – undo
111 115
     {
112 116
         $core = $this->getCore();
113 117
 
114
-        $core->setHandler(function ($req, $resp) {
118
+        $core->setHandler(function ($req, $resp)
119
+        {
115 120
             echo 'hello!';
116 121
             $resp->getBody()->write('world ');
117 122
 
@@ -128,7 +133,8 @@  discard block
 block discarded – undo
128 133
     {
129 134
         $core = $this->getCore();
130 135
 
131
-        $core->setHandler(function () {
136
+        $core->setHandler(function ()
137
+        {
132 138
             ob_start();
133 139
             ob_start();
134 140
             echo 'hello!';
@@ -149,7 +155,8 @@  discard block
 block discarded – undo
149 155
     {
150 156
         $core = $this->getCore();
151 157
 
152
-        $core->setHandler(function () {
158
+        $core->setHandler(function ()
159
+        {
153 160
             return [
154 161
                 'status' => 404,
155 162
                 'message' => 'not found',
@@ -165,7 +172,8 @@  discard block
 block discarded – undo
165 172
     {
166 173
         $core = $this->getCore();
167 174
 
168
-        $core->setHandler(function () {
175
+        $core->setHandler(function ()
176
+        {
169 177
             return new Json([
170 178
                 'status' => 404,
171 179
                 'message' => 'not found',
@@ -181,7 +189,8 @@  discard block
 block discarded – undo
181 189
     {
182 190
         $core = $this->getCore([HeaderMiddleware::class]);
183 191
 
184
-        $core->setHandler(function () {
192
+        $core->setHandler(function ()
193
+        {
185 194
             return 'hello?';
186 195
         });
187 196
 
@@ -198,7 +207,8 @@  discard block
 block discarded – undo
198 207
         $core->getPipeline()->pushMiddleware(new Header2Middleware());
199 208
         $core->getPipeline()->riseMiddleware(new HeaderMiddleware());
200 209
 
201
-        $core->setHandler(function () {
210
+        $core->setHandler(function ()
211
+        {
202 212
             return 'hello?';
203 213
         });
204 214
 
@@ -215,7 +225,8 @@  discard block
 block discarded – undo
215 225
         $core->getPipeline()->pushMiddleware(new HeaderMiddleware());
216 226
         $core->getPipeline()->riseMiddleware(new Header2Middleware());
217 227
 
218
-        $core->setHandler(function () {
228
+        $core->setHandler(function ()
229
+        {
219 230
             return 'hello?';
220 231
         });
221 232
 
@@ -253,7 +264,8 @@  discard block
 block discarded – undo
253 264
 
254 265
         $core = $this->getCore();
255 266
 
256
-        $core->setHandler(function () {
267
+        $core->setHandler(function ()
268
+        {
257 269
             return 'hello world';
258 270
         });
259 271
 
@@ -274,7 +286,8 @@  discard block
 block discarded – undo
274 286
             $tracerFactory = m::mock(TracerFactoryInterface::class),
275 287
         );
276 288
 
277
-        $http->setHandler(function () {
289
+        $http->setHandler(function ()
290
+        {
278 291
             return 'hello world';
279 292
         });
280 293
 
@@ -309,7 +322,8 @@  discard block
 block discarded – undo
309 322
                 TraceKind::SERVER,
310 323
             )
311 324
             ->willReturnCallback(
312
-                function ($name, $callback, $attributes, $scoped, $traceKind) {
325
+                function ($name, $callback, $attributes, $scoped, $traceKind)
326
+                {
313 327
                     self::assertSame($attributes, [
314 328
                         'http.method' => 'GET',
315 329
                         'http.url' => 'http://example.org/path',
@@ -339,7 +353,8 @@  discard block
 block discarded – undo
339 353
             $tracerFactory,
340 354
         );
341 355
 
342
-        $http->setHandler(function () {
356
+        $http->setHandler(function ()
357
+        {
343 358
             return 'hello world';
344 359
         });
345 360
 
@@ -360,7 +375,8 @@  discard block
 block discarded – undo
360 375
             $tracerFactory = m::mock(TracerFactoryInterface::class),
361 376
         );
362 377
 
363
-        $http->setHandler(function () {
378
+        $http->setHandler(function ()
379
+        {
364 380
             return 'hello world';
365 381
         });
366 382
 
@@ -372,7 +388,8 @@  discard block
 block discarded – undo
372 388
         $tracer
373 389
             ->shouldReceive('trace')
374 390
             ->once()
375
-            ->andReturnUsing(function($name, $callback, $attributes, $scoped, $traceKind) {
391
+            ->andReturnUsing(function($name, $callback, $attributes, $scoped, $traceKind)
392
+            {
376 393
                 return $this->container->get(TracerInterface::class)->trace($name, $callback, $attributes, $scoped, $traceKind);
377 394
             });
378 395
 
Please login to merge, or discard this patch.