@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $e = $this->bufferEmitter; |
58 | 58 | |
59 | 59 | $files = $this->app->get(FilesInterface::class)->getFiles( |
60 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
60 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | $this->assertCount(0, $files); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->app->get(SapiDispatcher::class)->serve($e); |
67 | 67 | |
68 | 68 | $files = $this->app->get(FilesInterface::class)->getFiles( |
69 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
69 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $this->assertCount(1, $files); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | ]); |
84 | 84 | |
85 | 85 | $files = $app->get(FilesInterface::class)->getFiles( |
86 | - $app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
86 | + $app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
87 | 87 | ); |
88 | 88 | |
89 | 89 | $this->assertCount(0, $files); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $app->get(SapiDispatcher::class)->serve($e); |
93 | 93 | |
94 | 94 | $files = $app->get(FilesInterface::class)->getFiles( |
95 | - $app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
95 | + $app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
96 | 96 | ); |
97 | 97 | |
98 | 98 | $this->assertCount(1, $files); |
@@ -27,9 +27,9 @@ |
||
27 | 27 | */ |
28 | 28 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
29 | 29 | { |
30 | - if ($this->isJsonPayload($request)) { |
|
30 | + if ($this->isJsonPayload($request)){ |
|
31 | 31 | $request = $request->withParsedBody(json_decode($request->getBody()->getContents(), true)); |
32 | - if (json_last_error() !== 0) { |
|
32 | + if (json_last_error() !== 0){ |
|
33 | 33 | throw new ClientException(400, 'invalid json payload'); |
34 | 34 | } |
35 | 35 | } |
@@ -27,9 +27,11 @@ |
||
27 | 27 | */ |
28 | 28 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
29 | 29 | { |
30 | - if ($this->isJsonPayload($request)) { |
|
30 | + if ($this->isJsonPayload($request)) |
|
31 | + { |
|
31 | 32 | $request = $request->withParsedBody(json_decode($request->getBody()->getContents(), true)); |
32 | - if (json_last_error() !== 0) { |
|
33 | + if (json_last_error() !== 0) |
|
34 | + { |
|
33 | 35 | throw new ClientException(400, 'invalid json payload'); |
34 | 36 | } |
35 | 37 | } |
@@ -37,8 +37,8 @@ |
||
37 | 37 | public function locateCommands(): array |
38 | 38 | { |
39 | 39 | $commands = []; |
40 | - foreach ($this->classes->getClasses(SymfonyCommand::class) as $class) { |
|
41 | - if ($class->isAbstract()) { |
|
40 | + foreach ($this->classes->getClasses(SymfonyCommand::class) as $class){ |
|
41 | + if ($class->isAbstract()){ |
|
42 | 42 | continue; |
43 | 43 | } |
44 | 44 |
@@ -37,8 +37,10 @@ |
||
37 | 37 | public function locateCommands(): array |
38 | 38 | { |
39 | 39 | $commands = []; |
40 | - foreach ($this->classes->getClasses(SymfonyCommand::class) as $class) { |
|
41 | - if ($class->isAbstract()) { |
|
40 | + foreach ($this->classes->getClasses(SymfonyCommand::class) as $class) |
|
41 | + { |
|
42 | + if ($class->isAbstract()) |
|
43 | + { |
|
42 | 44 | continue; |
43 | 45 | } |
44 | 46 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | EnvironmentInterface $env, |
38 | 38 | FinalizerInterface $finalizer, |
39 | 39 | ContainerInterface $container |
40 | - ) { |
|
40 | + ){ |
|
41 | 41 | $this->env = $env; |
42 | 42 | $this->finalizer = $finalizer; |
43 | 43 | $this->container = $container; |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | $consumer = $this->container->get(Consumer::class); |
64 | 64 | $worker = $this->container->get(Worker::class); |
65 | 65 | |
66 | - $consumer->serve($worker, function (\Throwable $e = null) { |
|
67 | - if ($e !== null) { |
|
66 | + $consumer->serve($worker, function (\Throwable $e = null){ |
|
67 | + if ($e !== null){ |
|
68 | 68 | $this->handleException($e); |
69 | 69 | } |
70 | 70 | |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function handleException(\Throwable $e) |
79 | 79 | { |
80 | - try { |
|
80 | + try{ |
|
81 | 81 | $this->container->get(SnapshotterInterface::class)->register($e); |
82 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
82 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
83 | 83 | // no need to notify when unable to register an exception |
84 | 84 | } |
85 | 85 | } |
@@ -63,8 +63,10 @@ discard block |
||
63 | 63 | $consumer = $this->container->get(Consumer::class); |
64 | 64 | $worker = $this->container->get(Worker::class); |
65 | 65 | |
66 | - $consumer->serve($worker, function (\Throwable $e = null) { |
|
67 | - if ($e !== null) { |
|
66 | + $consumer->serve($worker, function (\Throwable $e = null) |
|
67 | + { |
|
68 | + if ($e !== null) |
|
69 | + { |
|
68 | 70 | $this->handleException($e); |
69 | 71 | } |
70 | 72 | |
@@ -77,9 +79,12 @@ discard block |
||
77 | 79 | */ |
78 | 80 | protected function handleException(\Throwable $e) |
79 | 81 | { |
80 | - try { |
|
82 | + try |
|
83 | + { |
|
81 | 84 | $this->container->get(SnapshotterInterface::class)->register($e); |
82 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
85 | + } |
|
86 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
87 | + { |
|
83 | 88 | // no need to notify when unable to register an exception |
84 | 89 | } |
85 | 90 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | public function testSetSid() |
17 | 17 | { |
18 | - $this->http->setHandler(function () { |
|
18 | + $this->http->setHandler(function (){ |
|
19 | 19 | return ++$this->session()->getSection('cli')->value; |
20 | 20 | }); |
21 | 21 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public function testSessionResume() |
31 | 31 | { |
32 | - $this->http->setHandler(function () { |
|
32 | + $this->http->setHandler(function (){ |
|
33 | 33 | return ++$this->session()->getSection('cli')->value; |
34 | 34 | }); |
35 | 35 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | public function testSessionRegenerateId() |
55 | 55 | { |
56 | - $this->http->setHandler(function () { |
|
56 | + $this->http->setHandler(function (){ |
|
57 | 57 | return ++$this->session()->getSection('cli')->value; |
58 | 58 | }); |
59 | 59 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $this->assertSame(200, $result->getStatusCode()); |
71 | 71 | $this->assertSame('2', $result->getBody()->__toString()); |
72 | 72 | |
73 | - $this->http->setHandler(function () { |
|
73 | + $this->http->setHandler(function (){ |
|
74 | 74 | $this->session()->regenerateID(false); |
75 | 75 | |
76 | 76 | return ++$this->session()->getSection('cli')->value; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | public function testDestroySession() |
91 | 91 | { |
92 | - $this->http->setHandler(function () { |
|
92 | + $this->http->setHandler(function (){ |
|
93 | 93 | return ++$this->session()->getSection('cli')->value; |
94 | 94 | }); |
95 | 95 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | ]); |
103 | 103 | $this->assertSame(200, $result->getStatusCode()); |
104 | 104 | $this->assertSame('2', $result->getBody()->__toString()); |
105 | - $this->http->setHandler(function () { |
|
105 | + $this->http->setHandler(function (){ |
|
106 | 106 | $this->session()->destroy(); |
107 | 107 | $this->assertFalse($this->session()->isStarted()); |
108 | 108 |
@@ -15,7 +15,8 @@ discard block |
||
15 | 15 | { |
16 | 16 | public function testSetSid() |
17 | 17 | { |
18 | - $this->http->setHandler(function () { |
|
18 | + $this->http->setHandler(function () |
|
19 | + { |
|
19 | 20 | return ++$this->session()->getSection('cli')->value; |
20 | 21 | }); |
21 | 22 | |
@@ -29,7 +30,8 @@ discard block |
||
29 | 30 | |
30 | 31 | public function testSessionResume() |
31 | 32 | { |
32 | - $this->http->setHandler(function () { |
|
33 | + $this->http->setHandler(function () |
|
34 | + { |
|
33 | 35 | return ++$this->session()->getSection('cli')->value; |
34 | 36 | }); |
35 | 37 | |
@@ -53,7 +55,8 @@ discard block |
||
53 | 55 | |
54 | 56 | public function testSessionRegenerateId() |
55 | 57 | { |
56 | - $this->http->setHandler(function () { |
|
58 | + $this->http->setHandler(function () |
|
59 | + { |
|
57 | 60 | return ++$this->session()->getSection('cli')->value; |
58 | 61 | }); |
59 | 62 | |
@@ -70,7 +73,8 @@ discard block |
||
70 | 73 | $this->assertSame(200, $result->getStatusCode()); |
71 | 74 | $this->assertSame('2', $result->getBody()->__toString()); |
72 | 75 | |
73 | - $this->http->setHandler(function () { |
|
76 | + $this->http->setHandler(function () |
|
77 | + { |
|
74 | 78 | $this->session()->regenerateID(false); |
75 | 79 | |
76 | 80 | return ++$this->session()->getSection('cli')->value; |
@@ -89,7 +93,8 @@ discard block |
||
89 | 93 | |
90 | 94 | public function testDestroySession() |
91 | 95 | { |
92 | - $this->http->setHandler(function () { |
|
96 | + $this->http->setHandler(function () |
|
97 | + { |
|
93 | 98 | return ++$this->session()->getSection('cli')->value; |
94 | 99 | }); |
95 | 100 | |
@@ -102,7 +107,8 @@ discard block |
||
102 | 107 | ]); |
103 | 108 | $this->assertSame(200, $result->getStatusCode()); |
104 | 109 | $this->assertSame('2', $result->getBody()->__toString()); |
105 | - $this->http->setHandler(function () { |
|
110 | + $this->http->setHandler(function () |
|
111 | + { |
|
106 | 112 | $this->session()->destroy(); |
107 | 113 | $this->assertFalse($this->session()->isStarted()); |
108 | 114 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | public function inputAction(InputScope $i) |
48 | 48 | { |
49 | - return 'value: ' . $i->withPrefix('section')->getValue('query', 'value'); |
|
49 | + return 'value: '.$i->withPrefix('section')->getValue('query', 'value'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function errorAction() |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public function getValue(string $source, string $name = null) |
43 | 43 | { |
44 | - if (!method_exists($this->input, $source)) { |
|
44 | + if (!method_exists($this->input, $source)){ |
|
45 | 45 | throw new InputException("Undefined input source '{$source}'"); |
46 | 46 | } |
47 | 47 |
@@ -41,7 +41,8 @@ |
||
41 | 41 | */ |
42 | 42 | public function getValue(string $source, string $name = null) |
43 | 43 | { |
44 | - if (!method_exists($this->input, $source)) { |
|
44 | + if (!method_exists($this->input, $source)) |
|
45 | + { |
|
45 | 46 | throw new InputException("Undefined input source '{$source}'"); |
46 | 47 | } |
47 | 48 |
@@ -120,15 +120,15 @@ |
||
120 | 120 | */ |
121 | 121 | private function getSession(): SessionInterface |
122 | 122 | { |
123 | - try { |
|
123 | + try{ |
|
124 | 124 | $request = $this->container->get(ServerRequestInterface::class); |
125 | 125 | $session = $request->getAttribute(SessionMiddleware::ATTRIBUTE); |
126 | - if ($session === null) { |
|
126 | + if ($session === null){ |
|
127 | 127 | throw new ScopeException("Unable to receive active Session, invalid request scope"); |
128 | 128 | } |
129 | 129 | |
130 | 130 | return $session; |
131 | - } catch (NotFoundExceptionInterface $e) { |
|
131 | + }catch (NotFoundExceptionInterface $e){ |
|
132 | 132 | throw new ScopeException("Unable to receive active session", $e->getCode(), $e); |
133 | 133 | } |
134 | 134 | } |
@@ -120,15 +120,19 @@ |
||
120 | 120 | */ |
121 | 121 | private function getSession(): SessionInterface |
122 | 122 | { |
123 | - try { |
|
123 | + try |
|
124 | + { |
|
124 | 125 | $request = $this->container->get(ServerRequestInterface::class); |
125 | 126 | $session = $request->getAttribute(SessionMiddleware::ATTRIBUTE); |
126 | - if ($session === null) { |
|
127 | + if ($session === null) |
|
128 | + { |
|
127 | 129 | throw new ScopeException("Unable to receive active Session, invalid request scope"); |
128 | 130 | } |
129 | 131 | |
130 | 132 | return $session; |
131 | - } catch (NotFoundExceptionInterface $e) { |
|
133 | + } |
|
134 | + catch (NotFoundExceptionInterface $e) |
|
135 | + { |
|
132 | 136 | throw new ScopeException("Unable to receive active session", $e->getCode(), $e); |
133 | 137 | } |
134 | 138 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | CookiesConfig $cookiesConfig, |
58 | 58 | SessionFactory $factory, |
59 | 59 | ScopeInterface $scope |
60 | - ) { |
|
60 | + ){ |
|
61 | 61 | $this->config = $config; |
62 | 62 | $this->httpConfig = $httpConfig; |
63 | 63 | $this->cookiesConfig = $cookiesConfig; |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $this->fetchID($request) |
77 | 77 | ); |
78 | 78 | |
79 | - try { |
|
79 | + try{ |
|
80 | 80 | $response = $handler->handle($request->withAttribute(static::ATTRIBUTE, $session)); |
81 | - } catch (\Throwable $e) { |
|
81 | + }catch (\Throwable $e){ |
|
82 | 82 | $session->abort(); |
83 | 83 | throw $e; |
84 | 84 | } |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | Request $request, |
98 | 98 | Response $response |
99 | 99 | ): Response { |
100 | - if (!$session->isStarted()) { |
|
100 | + if (!$session->isStarted()){ |
|
101 | 101 | return $response; |
102 | 102 | } |
103 | 103 | |
104 | 104 | $session->commit(); |
105 | 105 | |
106 | 106 | //SID changed |
107 | - if ($this->fetchID($request) != $session->getID()) { |
|
107 | + if ($this->fetchID($request) != $session->getID()){ |
|
108 | 108 | return $this->withCookie($request, $response, $session->getID()); |
109 | 109 | } |
110 | 110 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | protected function fetchID(Request $request): ?string |
122 | 122 | { |
123 | 123 | $cookies = $request->getCookieParams(); |
124 | - if (empty($cookies[$this->config->getCookie()])) { |
|
124 | + if (empty($cookies[$this->config->getCookie()])){ |
|
125 | 125 | return null; |
126 | 126 | } |
127 | 127 | |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | protected function clientSignature(Request $request): string |
155 | 155 | { |
156 | 156 | $signature = ''; |
157 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
158 | - $signature .= $request->getHeaderLine($header) . ';'; |
|
157 | + foreach (static::SIGNATURE_HEADERS as $header){ |
|
158 | + $signature .= $request->getHeaderLine($header).';'; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | return hash('sha256', $signature); |
@@ -76,9 +76,12 @@ discard block |
||
76 | 76 | $this->fetchID($request) |
77 | 77 | ); |
78 | 78 | |
79 | - try { |
|
79 | + try |
|
80 | + { |
|
80 | 81 | $response = $handler->handle($request->withAttribute(static::ATTRIBUTE, $session)); |
81 | - } catch (\Throwable $e) { |
|
82 | + } |
|
83 | + catch (\Throwable $e) |
|
84 | + { |
|
82 | 85 | $session->abort(); |
83 | 86 | throw $e; |
84 | 87 | } |
@@ -97,14 +100,16 @@ discard block |
||
97 | 100 | Request $request, |
98 | 101 | Response $response |
99 | 102 | ): Response { |
100 | - if (!$session->isStarted()) { |
|
103 | + if (!$session->isStarted()) |
|
104 | + { |
|
101 | 105 | return $response; |
102 | 106 | } |
103 | 107 | |
104 | 108 | $session->commit(); |
105 | 109 | |
106 | 110 | //SID changed |
107 | - if ($this->fetchID($request) != $session->getID()) { |
|
111 | + if ($this->fetchID($request) != $session->getID()) |
|
112 | + { |
|
108 | 113 | return $this->withCookie($request, $response, $session->getID()); |
109 | 114 | } |
110 | 115 | |
@@ -121,7 +126,8 @@ discard block |
||
121 | 126 | protected function fetchID(Request $request): ?string |
122 | 127 | { |
123 | 128 | $cookies = $request->getCookieParams(); |
124 | - if (empty($cookies[$this->config->getCookie()])) { |
|
129 | + if (empty($cookies[$this->config->getCookie()])) |
|
130 | + { |
|
125 | 131 | return null; |
126 | 132 | } |
127 | 133 | |
@@ -154,7 +160,8 @@ discard block |
||
154 | 160 | protected function clientSignature(Request $request): string |
155 | 161 | { |
156 | 162 | $signature = ''; |
157 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
163 | + foreach (static::SIGNATURE_HEADERS as $header) |
|
164 | + { |
|
158 | 165 | $signature .= $request->getHeaderLine($header) . ';'; |
159 | 166 | } |
160 | 167 |