@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | HandlerInterface $handler, |
54 | 54 | FilesInterface $files, |
55 | 55 | LoggerInterface $logger = null |
56 | - ) { |
|
56 | + ){ |
|
57 | 57 | $this->directory = $directory; |
58 | 58 | $this->maxFiles = $maxFiles; |
59 | 59 | $this->verbosity = $verbosity; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $snapshot = new Snapshot($this->getID($e), $e); |
71 | 71 | |
72 | - if ($this->logger !== null) { |
|
72 | + if ($this->logger !== null){ |
|
73 | 73 | $this->logger->error($snapshot->getMessage()); |
74 | 74 | } |
75 | 75 | |
@@ -101,17 +101,17 @@ discard block |
||
101 | 101 | protected function rotateSnapshots(): void |
102 | 102 | { |
103 | 103 | $finder = new Finder(); |
104 | - $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b) { |
|
104 | + $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b){ |
|
105 | 105 | return $b->getMTime() - $a->getMTime(); |
106 | 106 | }); |
107 | 107 | |
108 | 108 | $count = 0; |
109 | - foreach ($finder as $file) { |
|
109 | + foreach ($finder as $file){ |
|
110 | 110 | $count++; |
111 | - if ($count > $this->maxFiles) { |
|
112 | - try { |
|
111 | + if ($count > $this->maxFiles){ |
|
112 | + try{ |
|
113 | 113 | $this->files->delete($file->getRealPath()); |
114 | - } catch (FilesException $e) { |
|
114 | + }catch (FilesException $e){ |
|
115 | 115 | // ignore |
116 | 116 | } |
117 | 117 | } |
@@ -69,7 +69,8 @@ discard block |
||
69 | 69 | { |
70 | 70 | $snapshot = new Snapshot($this->getID($e), $e); |
71 | 71 | |
72 | - if ($this->logger !== null) { |
|
72 | + if ($this->logger !== null) |
|
73 | + { |
|
73 | 74 | $this->logger->error($snapshot->getMessage()); |
74 | 75 | } |
75 | 76 | |
@@ -101,17 +102,23 @@ discard block |
||
101 | 102 | protected function rotateSnapshots(): void |
102 | 103 | { |
103 | 104 | $finder = new Finder(); |
104 | - $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b) { |
|
105 | + $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b) |
|
106 | + { |
|
105 | 107 | return $b->getMTime() - $a->getMTime(); |
106 | 108 | }); |
107 | 109 | |
108 | 110 | $count = 0; |
109 | - foreach ($finder as $file) { |
|
111 | + foreach ($finder as $file) |
|
112 | + { |
|
110 | 113 | $count++; |
111 | - if ($count > $this->maxFiles) { |
|
112 | - try { |
|
114 | + if ($count > $this->maxFiles) |
|
115 | + { |
|
116 | + try |
|
117 | + { |
|
113 | 118 | $this->files->delete($file->getRealPath()); |
114 | - } catch (FilesException $e) { |
|
119 | + } |
|
120 | + catch (FilesException $e) |
|
121 | + { |
|
115 | 122 | // ignore |
116 | 123 | } |
117 | 124 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | ); |
44 | 44 | |
45 | 45 | $psr->shouldReceive('respond')->once()->with( |
46 | - \Mockery::on(function ($r) { |
|
46 | + \Mockery::on(function ($r){ |
|
47 | 47 | $this->assertSame('Hello, dave.', (string)$r->getBody()); |
48 | 48 | return true; |
49 | 49 | }) |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | $psr->shouldReceive('respond')->once()->with( |
68 | - \Mockery::on(function ($r) { |
|
68 | + \Mockery::on(function ($r){ |
|
69 | 69 | $this->assertContains('500', (string)$r->getBody()); |
70 | 70 | return true; |
71 | 71 | }) |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $psr->shouldReceive('acceptRequest')->once()->andReturn(null); |
75 | 75 | |
76 | 76 | $files = $this->app->get(FilesInterface::class)->getFiles( |
77 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
77 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
78 | 78 | ); |
79 | 79 | |
80 | 80 | $this->assertCount(0, $files); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $this->app->get(RrDispacher::class)->serve($psr); |
83 | 83 | |
84 | 84 | $files = $this->app->get(FilesInterface::class)->getFiles( |
85 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
85 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
86 | 86 | ); |
87 | 87 | |
88 | 88 | $this->assertCount(1, $files); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ); |
104 | 104 | |
105 | 105 | $psr->shouldReceive('respond')->once()->with( |
106 | - \Mockery::on(function ($r) { |
|
106 | + \Mockery::on(function ($r){ |
|
107 | 107 | $this->assertContains('undefined', (string)$r->getBody()); |
108 | 108 | return true; |
109 | 109 | }) |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $psr->shouldReceive('acceptRequest')->once()->andReturn(null); |
113 | 113 | |
114 | 114 | $files = $this->app->get(FilesInterface::class)->getFiles( |
115 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
115 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
116 | 116 | ); |
117 | 117 | |
118 | 118 | $this->assertCount(0, $files); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->app->get(RrDispacher::class)->serve($psr); |
121 | 121 | |
122 | 122 | $files = $this->app->get(FilesInterface::class)->getFiles( |
123 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
123 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
124 | 124 | ); |
125 | 125 | |
126 | 126 | $this->assertCount(1, $files); |
@@ -43,7 +43,8 @@ discard block |
||
43 | 43 | ); |
44 | 44 | |
45 | 45 | $psr->shouldReceive('respond')->once()->with( |
46 | - \Mockery::on(function ($r) { |
|
46 | + \Mockery::on(function ($r) |
|
47 | + { |
|
47 | 48 | $this->assertSame('Hello, dave.', (string)$r->getBody()); |
48 | 49 | return true; |
49 | 50 | }) |
@@ -65,7 +66,8 @@ discard block |
||
65 | 66 | ); |
66 | 67 | |
67 | 68 | $psr->shouldReceive('respond')->once()->with( |
68 | - \Mockery::on(function ($r) { |
|
69 | + \Mockery::on(function ($r) |
|
70 | + { |
|
69 | 71 | $this->assertContains('500', (string)$r->getBody()); |
70 | 72 | return true; |
71 | 73 | }) |
@@ -103,7 +105,8 @@ discard block |
||
103 | 105 | ); |
104 | 106 | |
105 | 107 | $psr->shouldReceive('respond')->once()->with( |
106 | - \Mockery::on(function ($r) { |
|
108 | + \Mockery::on(function ($r) |
|
109 | + { |
|
107 | 110 | $this->assertContains('undefined', (string)$r->getBody()); |
108 | 111 | return true; |
109 | 112 | }) |
@@ -46,9 +46,9 @@ |
||
46 | 46 | DirectoriesInterface $dirs, |
47 | 47 | FilesInterface $files, |
48 | 48 | LoggerInterface $logger = null |
49 | - ) { |
|
49 | + ){ |
|
50 | 50 | return new FileSnapshotter( |
51 | - $dirs->get('runtime') . '/snapshots/', |
|
51 | + $dirs->get('runtime').'/snapshots/', |
|
52 | 52 | $env->get('SNAPSHOT_MAX_FILES', self::MAX_SNAPSHOTS), |
53 | 53 | $env->get('SNAPSHOT_VERBOSITY', HandlerInterface::VERBOSITY_VERBOSE), |
54 | 54 | new PlainHandler(), |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | FinalizerInterface $finalizer, |
50 | 50 | ContainerInterface $container, |
51 | 51 | FactoryInterface $factory |
52 | - ) { |
|
52 | + ){ |
|
53 | 53 | $this->env = $env; |
54 | 54 | $this->finalizer = $finalizer; |
55 | 55 | $this->container = $container; |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | |
76 | 76 | /** @var Http $http */ |
77 | 77 | $http = $this->container->get(Http::class); |
78 | - while ($request = $client->acceptRequest()) { |
|
79 | - try { |
|
78 | + while ($request = $client->acceptRequest()){ |
|
79 | + try{ |
|
80 | 80 | $client->respond($http->handle($request)); |
81 | - } catch (\Throwable $e) { |
|
81 | + }catch (\Throwable $e){ |
|
82 | 82 | $this->handleException($client, $e); |
83 | - } finally { |
|
83 | + }finally{ |
|
84 | 84 | $this->finalizer->finalize(false); |
85 | 85 | } |
86 | 86 | } |
@@ -94,17 +94,17 @@ discard block |
||
94 | 94 | { |
95 | 95 | $handler = new HtmlHandler(); |
96 | 96 | |
97 | - try { |
|
97 | + try{ |
|
98 | 98 | /** @var SnapshotInterface $snapshot */ |
99 | 99 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
100 | 100 | error_log($snapshot->getMessage()); |
101 | 101 | |
102 | 102 | // on demand |
103 | 103 | $state = $this->container->get(StateInterface::class); |
104 | - if ($state !== null) { |
|
104 | + if ($state !== null){ |
|
105 | 105 | $handler = $handler->withState($state); |
106 | 106 | } |
107 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
107 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
108 | 108 | error_log((string)$e); |
109 | 109 | } |
110 | 110 |
@@ -75,12 +75,18 @@ discard block |
||
75 | 75 | |
76 | 76 | /** @var Http $http */ |
77 | 77 | $http = $this->container->get(Http::class); |
78 | - while ($request = $client->acceptRequest()) { |
|
79 | - try { |
|
78 | + while ($request = $client->acceptRequest()) |
|
79 | + { |
|
80 | + try |
|
81 | + { |
|
80 | 82 | $client->respond($http->handle($request)); |
81 | - } catch (\Throwable $e) { |
|
83 | + } |
|
84 | + catch (\Throwable $e) |
|
85 | + { |
|
82 | 86 | $this->handleException($client, $e); |
83 | - } finally { |
|
87 | + } |
|
88 | + finally |
|
89 | + { |
|
84 | 90 | $this->finalizer->finalize(false); |
85 | 91 | } |
86 | 92 | } |
@@ -94,17 +100,21 @@ discard block |
||
94 | 100 | { |
95 | 101 | $handler = new HtmlHandler(); |
96 | 102 | |
97 | - try { |
|
103 | + try |
|
104 | + { |
|
98 | 105 | /** @var SnapshotInterface $snapshot */ |
99 | 106 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
100 | 107 | error_log($snapshot->getMessage()); |
101 | 108 | |
102 | 109 | // on demand |
103 | 110 | $state = $this->container->get(StateInterface::class); |
104 | - if ($state !== null) { |
|
111 | + if ($state !== null) |
|
112 | + { |
|
105 | 113 | $handler = $handler->withState($state); |
106 | 114 | } |
107 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
115 | + } |
|
116 | + catch (\Throwable | ContainerExceptionInterface $se) |
|
117 | + { |
|
108 | 118 | error_log((string)$e); |
109 | 119 | } |
110 | 120 |
@@ -40,9 +40,9 @@ |
||
40 | 40 | public function renderException(Request $request, int $code, string $message): Response |
41 | 41 | { |
42 | 42 | $response = $this->responseFactory->createResponse($code); |
43 | - if ($request->getHeaderLine('Accept') == 'application/json') { |
|
43 | + if ($request->getHeaderLine('Accept') == 'application/json'){ |
|
44 | 44 | $response->getBody()->write(json_encode(['status' => 500, 'error' => $message])); |
45 | - } else { |
|
45 | + }else{ |
|
46 | 46 | $response->getBody()->write("Error code: {$code}"); |
47 | 47 | } |
48 | 48 |
@@ -40,9 +40,12 @@ |
||
40 | 40 | public function renderException(Request $request, int $code, string $message): Response |
41 | 41 | { |
42 | 42 | $response = $this->responseFactory->createResponse($code); |
43 | - if ($request->getHeaderLine('Accept') == 'application/json') { |
|
43 | + if ($request->getHeaderLine('Accept') == 'application/json') |
|
44 | + { |
|
44 | 45 | $response->getBody()->write(json_encode(['status' => 500, 'error' => $message])); |
45 | - } else { |
|
46 | + } |
|
47 | + else |
|
48 | + { |
|
46 | 49 | $response->getBody()->write("Error code: {$code}"); |
47 | 50 | } |
48 | 51 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | RendererInterface $renderer, |
58 | 58 | ResponseFactoryInterface $responseFactory, |
59 | 59 | ContainerInterface $container |
60 | - ) { |
|
60 | + ){ |
|
61 | 61 | $this->suppressErrors = $suppressErrors; |
62 | 62 | $this->renderer = $renderer; |
63 | 63 | $this->responseFactory = $responseFactory; |
@@ -71,24 +71,24 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function process(Request $request, Handler $handler): Response |
73 | 73 | { |
74 | - try { |
|
74 | + try{ |
|
75 | 75 | return $handler->handle($request); |
76 | - } catch (ClientException | RouterException $e) { |
|
77 | - if ($e instanceof ClientException) { |
|
76 | + }catch (ClientException | RouterException $e){ |
|
77 | + if ($e instanceof ClientException){ |
|
78 | 78 | $code = $e->getCode(); |
79 | - } else { |
|
79 | + }else{ |
|
80 | 80 | $code = 404; |
81 | 81 | } |
82 | - } catch (\Throwable $e) { |
|
82 | + }catch (\Throwable $e){ |
|
83 | 83 | $snapshotter = $this->getOptional(SnapshotterInterface::class); |
84 | - if ($snapshotter !== null) { |
|
84 | + if ($snapshotter !== null){ |
|
85 | 85 | /** @var SnapshotterInterface $snapshotter */ |
86 | 86 | $snapshotter->register($e); |
87 | 87 | } |
88 | 88 | |
89 | 89 | $code = 500; |
90 | 90 | |
91 | - if (!$this->suppressErrors) { |
|
91 | + if (!$this->suppressErrors){ |
|
92 | 92 | return $this->renderException($request, $e); |
93 | 93 | } |
94 | 94 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $response = $this->responseFactory->createResponse(500); |
111 | 111 | |
112 | - if ($request->getHeaderLine('Accept') == 'application/json') { |
|
112 | + if ($request->getHeaderLine('Accept') == 'application/json'){ |
|
113 | 113 | $response = $response->withHeader('Content-Type', 'application/json'); |
114 | 114 | $handler = new JsonHandler(); |
115 | 115 | $response->getBody()->write(json_encode( |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | true |
120 | 120 | ) |
121 | 121 | )); |
122 | - } else { |
|
122 | + }else{ |
|
123 | 123 | $handler = new HtmlHandler(); |
124 | 124 | $state = $this->getOptional(StateInterface::class); |
125 | - if ($state !== null) { |
|
125 | + if ($state !== null){ |
|
126 | 126 | $handler = $handler->withState($state); |
127 | 127 | } |
128 | 128 | |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | */ |
157 | 157 | private function getOptional(string $class) |
158 | 158 | { |
159 | - try { |
|
159 | + try{ |
|
160 | 160 | return $this->container->get($class); |
161 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
161 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
162 | 162 | return null; |
163 | 163 | } |
164 | 164 | } |
@@ -71,24 +71,34 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function process(Request $request, Handler $handler): Response |
73 | 73 | { |
74 | - try { |
|
74 | + try |
|
75 | + { |
|
75 | 76 | return $handler->handle($request); |
76 | - } catch (ClientException | RouterException $e) { |
|
77 | - if ($e instanceof ClientException) { |
|
77 | + } |
|
78 | + catch (ClientException | RouterException $e) |
|
79 | + { |
|
80 | + if ($e instanceof ClientException) |
|
81 | + { |
|
78 | 82 | $code = $e->getCode(); |
79 | - } else { |
|
83 | + } |
|
84 | + else |
|
85 | + { |
|
80 | 86 | $code = 404; |
81 | 87 | } |
82 | - } catch (\Throwable $e) { |
|
88 | + } |
|
89 | + catch (\Throwable $e) |
|
90 | + { |
|
83 | 91 | $snapshotter = $this->getOptional(SnapshotterInterface::class); |
84 | - if ($snapshotter !== null) { |
|
92 | + if ($snapshotter !== null) |
|
93 | + { |
|
85 | 94 | /** @var SnapshotterInterface $snapshotter */ |
86 | 95 | $snapshotter->register($e); |
87 | 96 | } |
88 | 97 | |
89 | 98 | $code = 500; |
90 | 99 | |
91 | - if (!$this->suppressErrors) { |
|
100 | + if (!$this->suppressErrors) |
|
101 | + { |
|
92 | 102 | return $this->renderException($request, $e); |
93 | 103 | } |
94 | 104 | } |
@@ -109,7 +119,8 @@ discard block |
||
109 | 119 | { |
110 | 120 | $response = $this->responseFactory->createResponse(500); |
111 | 121 | |
112 | - if ($request->getHeaderLine('Accept') == 'application/json') { |
|
122 | + if ($request->getHeaderLine('Accept') == 'application/json') |
|
123 | + { |
|
113 | 124 | $response = $response->withHeader('Content-Type', 'application/json'); |
114 | 125 | $handler = new JsonHandler(); |
115 | 126 | $response->getBody()->write(json_encode( |
@@ -119,10 +130,13 @@ discard block |
||
119 | 130 | true |
120 | 131 | ) |
121 | 132 | )); |
122 | - } else { |
|
133 | + } |
|
134 | + else |
|
135 | + { |
|
123 | 136 | $handler = new HtmlHandler(); |
124 | 137 | $state = $this->getOptional(StateInterface::class); |
125 | - if ($state !== null) { |
|
138 | + if ($state !== null) |
|
139 | + { |
|
126 | 140 | $handler = $handler->withState($state); |
127 | 141 | } |
128 | 142 | |
@@ -156,9 +170,12 @@ discard block |
||
156 | 170 | */ |
157 | 171 | private function getOptional(string $class) |
158 | 172 | { |
159 | - try { |
|
173 | + try |
|
174 | + { |
|
160 | 175 | return $this->container->get($class); |
161 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
176 | + } |
|
177 | + catch (\Throwable | ContainerExceptionInterface $se) |
|
178 | + { |
|
162 | 179 | return null; |
163 | 180 | } |
164 | 181 | } |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | $http = $this->container->get(Http::class); |
63 | 63 | $emitter = $emitter ?? $this->container->get(EmitterInterface::class); |
64 | 64 | |
65 | - try { |
|
65 | + try{ |
|
66 | 66 | $response = $http->handle($this->initRequest()); |
67 | 67 | $emitter->emit($response); |
68 | - } catch (\Throwable $e) { |
|
68 | + }catch (\Throwable $e){ |
|
69 | 69 | $this->handleException($emitter, $e); |
70 | - } finally { |
|
70 | + }finally{ |
|
71 | 71 | $this->finalizer->finalize(false); |
72 | 72 | } |
73 | 73 | } |
@@ -88,16 +88,16 @@ discard block |
||
88 | 88 | { |
89 | 89 | $handler = new HtmlHandler(); |
90 | 90 | |
91 | - try { |
|
91 | + try{ |
|
92 | 92 | /** @var SnapshotInterface $snapshot */ |
93 | 93 | $this->container->get(SnapshotterInterface::class)->register($e); |
94 | 94 | |
95 | 95 | // on demand |
96 | 96 | $state = $this->container->get(StateInterface::class); |
97 | - if ($state !== null) { |
|
97 | + if ($state !== null){ |
|
98 | 98 | $handler = $handler->withState($state); |
99 | 99 | } |
100 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
100 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
101 | 101 | // nothing to report |
102 | 102 | } |
103 | 103 |
@@ -62,12 +62,17 @@ discard block |
||
62 | 62 | $http = $this->container->get(Http::class); |
63 | 63 | $emitter = $emitter ?? $this->container->get(EmitterInterface::class); |
64 | 64 | |
65 | - try { |
|
65 | + try |
|
66 | + { |
|
66 | 67 | $response = $http->handle($this->initRequest()); |
67 | 68 | $emitter->emit($response); |
68 | - } catch (\Throwable $e) { |
|
69 | + } |
|
70 | + catch (\Throwable $e) |
|
71 | + { |
|
69 | 72 | $this->handleException($emitter, $e); |
70 | - } finally { |
|
73 | + } |
|
74 | + finally |
|
75 | + { |
|
71 | 76 | $this->finalizer->finalize(false); |
72 | 77 | } |
73 | 78 | } |
@@ -88,16 +93,20 @@ discard block |
||
88 | 93 | { |
89 | 94 | $handler = new HtmlHandler(); |
90 | 95 | |
91 | - try { |
|
96 | + try |
|
97 | + { |
|
92 | 98 | /** @var SnapshotInterface $snapshot */ |
93 | 99 | $this->container->get(SnapshotterInterface::class)->register($e); |
94 | 100 | |
95 | 101 | // on demand |
96 | 102 | $state = $this->container->get(StateInterface::class); |
97 | - if ($state !== null) { |
|
103 | + if ($state !== null) |
|
104 | + { |
|
98 | 105 | $handler = $handler->withState($state); |
99 | 106 | } |
100 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
107 | + } |
|
108 | + catch (\Throwable | ContainerExceptionInterface $se) |
|
109 | + { |
|
101 | 110 | // nothing to report |
102 | 111 | } |
103 | 112 |
@@ -43,8 +43,8 @@ |
||
43 | 43 | { |
44 | 44 | $state->setTag('php', phpversion()); |
45 | 45 | |
46 | - if ($this->container->get(DispatcherInterface::class)) { |
|
47 | - switch (get_class($this->container->get(DispatcherInterface::class))) { |
|
46 | + if ($this->container->get(DispatcherInterface::class)){ |
|
47 | + switch (get_class($this->container->get(DispatcherInterface::class))){ |
|
48 | 48 | case RrDispacher::class: |
49 | 49 | $state->setTag('dispatcher', 'roadrunner'); |
50 | 50 | break; |
@@ -43,8 +43,10 @@ |
||
43 | 43 | { |
44 | 44 | $state->setTag('php', phpversion()); |
45 | 45 | |
46 | - if ($this->container->get(DispatcherInterface::class)) { |
|
47 | - switch (get_class($this->container->get(DispatcherInterface::class))) { |
|
46 | + if ($this->container->get(DispatcherInterface::class)) |
|
47 | + { |
|
48 | + switch (get_class($this->container->get(DispatcherInterface::class))) |
|
49 | + { |
|
48 | 50 | case RrDispacher::class: |
49 | 51 | $state->setTag('dispatcher', 'roadrunner'); |
50 | 52 | break; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function populate(StateInterface $state): void |
41 | 41 | { |
42 | - if (!$this->request === null) { |
|
42 | + if (!$this->request === null){ |
|
43 | 43 | return; |
44 | 44 | } |
45 | 45 | |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | |
49 | 49 | $state->setVariable('headers', $this->request->getHeaders()); |
50 | 50 | |
51 | - if ($this->request->getQueryParams() !== []) { |
|
51 | + if ($this->request->getQueryParams() !== []){ |
|
52 | 52 | $state->setVariable('query', $this->request->getQueryParams()); |
53 | 53 | } |
54 | 54 | |
55 | - if ($this->request->getParsedBody() !== null) { |
|
55 | + if ($this->request->getParsedBody() !== null){ |
|
56 | 56 | $state->setVariable('data', $this->request->getParsedBody()); |
57 | 57 | } |
58 | 58 | } |
@@ -39,7 +39,8 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function populate(StateInterface $state): void |
41 | 41 | { |
42 | - if (!$this->request === null) { |
|
42 | + if (!$this->request === null) |
|
43 | + { |
|
43 | 44 | return; |
44 | 45 | } |
45 | 46 | |
@@ -48,11 +49,13 @@ discard block |
||
48 | 49 | |
49 | 50 | $state->setVariable('headers', $this->request->getHeaders()); |
50 | 51 | |
51 | - if ($this->request->getQueryParams() !== []) { |
|
52 | + if ($this->request->getQueryParams() !== []) |
|
53 | + { |
|
52 | 54 | $state->setVariable('query', $this->request->getQueryParams()); |
53 | 55 | } |
54 | 56 | |
55 | - if ($this->request->getParsedBody() !== null) { |
|
57 | + if ($this->request->getParsedBody() !== null) |
|
58 | + { |
|
56 | 59 | $state->setVariable('data', $this->request->getParsedBody()); |
57 | 60 | } |
58 | 61 | } |