@@ -12,4 +12,4 @@ |
||
12 | 12 | ini_set('display_errors', '1'); |
13 | 13 | |
14 | 14 | //Composer |
15 | -require dirname(__DIR__) . '/vendor/autoload.php'; |
|
15 | +require dirname(__DIR__).'/vendor/autoload.php'; |
@@ -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 |
@@ -57,7 +57,7 @@ |
||
57 | 57 | private function route(ServerRequestInterface $request): RouteInterface |
58 | 58 | { |
59 | 59 | $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null); |
60 | - if ($route === null) { |
|
60 | + if ($route === null){ |
|
61 | 61 | throw new ScopeException('Unable to resolve Route, invalid request scope'); |
62 | 62 | } |
63 | 63 |
@@ -57,7 +57,8 @@ |
||
57 | 57 | private function route(ServerRequestInterface $request): RouteInterface |
58 | 58 | { |
59 | 59 | $route = $request->getAttribute(Router::ROUTE_ATTRIBUTE, null); |
60 | - if ($route === null) { |
|
60 | + if ($route === null) |
|
61 | + { |
|
61 | 62 | throw new ScopeException('Unable to resolve Route, invalid request scope'); |
62 | 63 | } |
63 | 64 |
@@ -72,7 +72,7 @@ |
||
72 | 72 | private function cookieQueue(ServerRequestInterface $request): CookieQueue |
73 | 73 | { |
74 | 74 | $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE, null); |
75 | - if ($cookieQueue === null) { |
|
75 | + if ($cookieQueue === null){ |
|
76 | 76 | throw new ScopeException('Unable to resolve CookieQueue, invalid request scope'); |
77 | 77 | } |
78 | 78 |
@@ -72,7 +72,8 @@ |
||
72 | 72 | private function cookieQueue(ServerRequestInterface $request): CookieQueue |
73 | 73 | { |
74 | 74 | $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE, null); |
75 | - if ($cookieQueue === null) { |
|
75 | + if ($cookieQueue === null) |
|
76 | + { |
|
76 | 77 | throw new ScopeException('Unable to resolve CookieQueue, invalid request scope'); |
77 | 78 | } |
78 | 79 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $this->assertNull($this->app->getEnvironment()->get('FIRED')); |
42 | 42 | |
43 | 43 | $w->shouldReceive('receive')->once()->with( |
44 | - \Mockery::on(function (&$context) { |
|
44 | + \Mockery::on(function (&$context){ |
|
45 | 45 | $context = '{ |
46 | 46 | "id": "1", |
47 | 47 | "job": "spiral.app.job.TestJob" |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $this->app->getContainer()->bind(Worker::class, $w); |
70 | 70 | |
71 | 71 | $w->shouldReceive('receive')->once()->with( |
72 | - \Mockery::on(function (&$context) { |
|
72 | + \Mockery::on(function (&$context){ |
|
73 | 73 | $context = '{ |
74 | 74 | "id": "1", |
75 | 75 | "job": "spiral.app.job.ErrorJob" |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $w->shouldReceive('receive')->once()->andReturn(null); |
86 | 86 | |
87 | 87 | $files = $this->app->get(FilesInterface::class)->getFiles( |
88 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
88 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | $this->assertCount(0, $files); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $this->app->get(JobDispatcher::class)->serve(); |
94 | 94 | |
95 | 95 | $files = $this->app->get(FilesInterface::class)->getFiles( |
96 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
96 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
97 | 97 | ); |
98 | 98 | |
99 | 99 | $this->assertCount(1, $files); |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | $this->assertNull($this->app->getEnvironment()->get('FIRED')); |
42 | 42 | |
43 | 43 | $w->shouldReceive('receive')->once()->with( |
44 | - \Mockery::on(function (&$context) { |
|
44 | + \Mockery::on(function (&$context) |
|
45 | + { |
|
45 | 46 | $context = '{ |
46 | 47 | "id": "1", |
47 | 48 | "job": "spiral.app.job.TestJob" |
@@ -69,7 +70,8 @@ discard block |
||
69 | 70 | $this->app->getContainer()->bind(Worker::class, $w); |
70 | 71 | |
71 | 72 | $w->shouldReceive('receive')->once()->with( |
72 | - \Mockery::on(function (&$context) { |
|
73 | + \Mockery::on(function (&$context) |
|
74 | + { |
|
73 | 75 | $context = '{ |
74 | 76 | "id": "1", |
75 | 77 | "job": "spiral.app.job.ErrorJob" |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | { |
19 | 19 | public function testSetSid(): void |
20 | 20 | { |
21 | - $this->http->setHandler(function () { |
|
21 | + $this->http->setHandler(function (){ |
|
22 | 22 | return ++$this->session()->getSection('cli')->value; |
23 | 23 | }); |
24 | 24 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | public function testSessionResume(): void |
34 | 34 | { |
35 | - $this->http->setHandler(function () { |
|
35 | + $this->http->setHandler(function (){ |
|
36 | 36 | return ++$this->session()->getSection('cli')->value; |
37 | 37 | }); |
38 | 38 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | public function testSessionRegenerateId(): void |
58 | 58 | { |
59 | - $this->http->setHandler(function () { |
|
59 | + $this->http->setHandler(function (){ |
|
60 | 60 | return ++$this->session()->getSection('cli')->value; |
61 | 61 | }); |
62 | 62 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $this->assertSame(200, $result->getStatusCode()); |
74 | 74 | $this->assertSame('2', $result->getBody()->__toString()); |
75 | 75 | |
76 | - $this->http->setHandler(function () { |
|
76 | + $this->http->setHandler(function (){ |
|
77 | 77 | $this->session()->regenerateID(false); |
78 | 78 | |
79 | 79 | return ++$this->session()->getSection('cli')->value; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | public function testDestroySession(): void |
94 | 94 | { |
95 | - $this->http->setHandler(function () { |
|
95 | + $this->http->setHandler(function (){ |
|
96 | 96 | return ++$this->session()->getSection('cli')->value; |
97 | 97 | }); |
98 | 98 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | ]); |
106 | 106 | $this->assertSame(200, $result->getStatusCode()); |
107 | 107 | $this->assertSame('2', $result->getBody()->__toString()); |
108 | - $this->http->setHandler(function () { |
|
108 | + $this->http->setHandler(function (){ |
|
109 | 109 | $this->session()->destroy(); |
110 | 110 | $this->assertFalse($this->session()->isStarted()); |
111 | 111 |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | { |
19 | 19 | public function testSetSid(): void |
20 | 20 | { |
21 | - $this->http->setHandler(function () { |
|
21 | + $this->http->setHandler(function () |
|
22 | + { |
|
22 | 23 | return ++$this->session()->getSection('cli')->value; |
23 | 24 | }); |
24 | 25 | |
@@ -32,7 +33,8 @@ discard block |
||
32 | 33 | |
33 | 34 | public function testSessionResume(): void |
34 | 35 | { |
35 | - $this->http->setHandler(function () { |
|
36 | + $this->http->setHandler(function () |
|
37 | + { |
|
36 | 38 | return ++$this->session()->getSection('cli')->value; |
37 | 39 | }); |
38 | 40 | |
@@ -56,7 +58,8 @@ discard block |
||
56 | 58 | |
57 | 59 | public function testSessionRegenerateId(): void |
58 | 60 | { |
59 | - $this->http->setHandler(function () { |
|
61 | + $this->http->setHandler(function () |
|
62 | + { |
|
60 | 63 | return ++$this->session()->getSection('cli')->value; |
61 | 64 | }); |
62 | 65 | |
@@ -73,7 +76,8 @@ discard block |
||
73 | 76 | $this->assertSame(200, $result->getStatusCode()); |
74 | 77 | $this->assertSame('2', $result->getBody()->__toString()); |
75 | 78 | |
76 | - $this->http->setHandler(function () { |
|
79 | + $this->http->setHandler(function () |
|
80 | + { |
|
77 | 81 | $this->session()->regenerateID(false); |
78 | 82 | |
79 | 83 | return ++$this->session()->getSection('cli')->value; |
@@ -92,7 +96,8 @@ discard block |
||
92 | 96 | |
93 | 97 | public function testDestroySession(): void |
94 | 98 | { |
95 | - $this->http->setHandler(function () { |
|
99 | + $this->http->setHandler(function () |
|
100 | + { |
|
96 | 101 | return ++$this->session()->getSection('cli')->value; |
97 | 102 | }); |
98 | 103 | |
@@ -105,7 +110,8 @@ discard block |
||
105 | 110 | ]); |
106 | 111 | $this->assertSame(200, $result->getStatusCode()); |
107 | 112 | $this->assertSame('2', $result->getBody()->__toString()); |
108 | - $this->http->setHandler(function () { |
|
113 | + $this->http->setHandler(function () |
|
114 | + { |
|
109 | 115 | $this->session()->destroy(); |
110 | 116 | $this->assertFalse($this->session()->isStarted()); |
111 | 117 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | public function setUp(): void |
27 | 27 | { |
28 | - $this->bufferEmitter = new class() implements EmitterInterface { |
|
28 | + $this->bufferEmitter = new class() implements EmitterInterface{ |
|
29 | 29 | public $response; |
30 | 30 | |
31 | 31 | public function emit(ResponseInterface $response): bool |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $e = $this->bufferEmitter; |
60 | 60 | |
61 | 61 | $files = $this->app->get(FilesInterface::class)->getFiles( |
62 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
62 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
63 | 63 | ); |
64 | 64 | |
65 | 65 | $this->assertCount(0, $files); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $this->app->get(SapiDispatcher::class)->serve($e); |
69 | 69 | |
70 | 70 | $files = $this->app->get(FilesInterface::class)->getFiles( |
71 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
71 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
72 | 72 | ); |
73 | 73 | |
74 | 74 | $this->assertCount(1, $files); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ]); |
86 | 86 | |
87 | 87 | $files = $app->get(FilesInterface::class)->getFiles( |
88 | - $app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
88 | + $app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | $this->assertCount(0, $files); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $app->get(SapiDispatcher::class)->serve($e); |
95 | 95 | |
96 | 96 | $files = $app->get(FilesInterface::class)->getFiles( |
97 | - $app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
97 | + $app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
98 | 98 | ); |
99 | 99 | |
100 | 100 | $this->assertCount(1, $files); |
@@ -25,7 +25,8 @@ |
||
25 | 25 | |
26 | 26 | public function setUp(): void |
27 | 27 | { |
28 | - $this->bufferEmitter = new class() implements EmitterInterface { |
|
28 | + $this->bufferEmitter = new class() implements EmitterInterface |
|
29 | + { |
|
29 | 30 | public $response; |
30 | 31 | |
31 | 32 | public function emit(ResponseInterface $response): bool |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | string $domain = null, |
119 | 119 | bool $secure = null, |
120 | 120 | bool $httpOnly = true |
121 | - ) { |
|
121 | + ){ |
|
122 | 122 | $this->getCookieQueue()->set($name, $value, $lifetime, $path, $domain, $secure, $httpOnly); |
123 | 123 | |
124 | 124 | return $this; |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | */ |
170 | 170 | private function getRequest(): ServerRequestInterface |
171 | 171 | { |
172 | - try { |
|
172 | + try{ |
|
173 | 173 | return $this->container->get(ServerRequestInterface::class); |
174 | - } catch (NotFoundExceptionInterface $e) { |
|
174 | + }catch (NotFoundExceptionInterface $e){ |
|
175 | 175 | throw new ScopeException('Unable to receive active request', $e->getCode(), $e); |
176 | 176 | } |
177 | 177 | } |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | */ |
184 | 184 | private function getCookieQueue(): CookieQueue |
185 | 185 | { |
186 | - try { |
|
186 | + try{ |
|
187 | 187 | return $this->container->get(CookieQueue::class); |
188 | - } catch (NotFoundExceptionInterface $e) { |
|
188 | + }catch (NotFoundExceptionInterface $e){ |
|
189 | 189 | throw new ScopeException('Unable to receive cookie queue, invalid request scope', $e->getCode(), $e); |
190 | 190 | } |
191 | 191 | } |
@@ -169,9 +169,12 @@ discard block |
||
169 | 169 | */ |
170 | 170 | private function getRequest(): ServerRequestInterface |
171 | 171 | { |
172 | - try { |
|
172 | + try |
|
173 | + { |
|
173 | 174 | return $this->container->get(ServerRequestInterface::class); |
174 | - } catch (NotFoundExceptionInterface $e) { |
|
175 | + } |
|
176 | + catch (NotFoundExceptionInterface $e) |
|
177 | + { |
|
175 | 178 | throw new ScopeException('Unable to receive active request', $e->getCode(), $e); |
176 | 179 | } |
177 | 180 | } |
@@ -183,9 +186,12 @@ discard block |
||
183 | 186 | */ |
184 | 187 | private function getCookieQueue(): CookieQueue |
185 | 188 | { |
186 | - try { |
|
189 | + try |
|
190 | + { |
|
187 | 191 | return $this->container->get(CookieQueue::class); |
188 | - } catch (NotFoundExceptionInterface $e) { |
|
192 | + } |
|
193 | + catch (NotFoundExceptionInterface $e) |
|
194 | + { |
|
189 | 195 | throw new ScopeException('Unable to receive cookie queue, invalid request scope', $e->getCode(), $e); |
190 | 196 | } |
191 | 197 | } |
@@ -94,9 +94,9 @@ |
||
94 | 94 | */ |
95 | 95 | private function getAuthContext(): AuthContextInterface |
96 | 96 | { |
97 | - try { |
|
97 | + try{ |
|
98 | 98 | return $this->container->get(AuthContextInterface::class); |
99 | - } catch (NotFoundExceptionInterface $e) { |
|
99 | + }catch (NotFoundExceptionInterface $e){ |
|
100 | 100 | throw new ScopeException('Unable to resolve auth context, invalid scope', $e->getCode(), $e); |
101 | 101 | } |
102 | 102 | } |
@@ -94,9 +94,12 @@ |
||
94 | 94 | */ |
95 | 95 | private function getAuthContext(): AuthContextInterface |
96 | 96 | { |
97 | - try { |
|
97 | + try |
|
98 | + { |
|
98 | 99 | return $this->container->get(AuthContextInterface::class); |
99 | - } catch (NotFoundExceptionInterface $e) { |
|
100 | + } |
|
101 | + catch (NotFoundExceptionInterface $e) |
|
102 | + { |
|
100 | 103 | throw new ScopeException('Unable to resolve auth context, invalid scope', $e->getCode(), $e); |
101 | 104 | } |
102 | 105 | } |