@@ -67,7 +67,7 @@ |
||
67 | 67 | $handler = m::mock(HandlerInterface::class) |
68 | 68 | ); |
69 | 69 | |
70 | - $callback = function () { |
|
70 | + $callback = function (){ |
|
71 | 71 | return 'bar'; |
72 | 72 | }; |
73 | 73 |
@@ -67,7 +67,8 @@ |
||
67 | 67 | $handler = m::mock(HandlerInterface::class) |
68 | 68 | ); |
69 | 69 | |
70 | - $callback = function () { |
|
70 | + $callback = function () |
|
71 | + { |
|
71 | 72 | return 'bar'; |
72 | 73 | }; |
73 | 74 |
@@ -31,7 +31,8 @@ |
||
31 | 31 | 'string' => 'foo', |
32 | 32 | 'array' => ['foo'], |
33 | 33 | 'object' => $object, |
34 | - 'closure' => function () use ($object) { |
|
34 | + 'closure' => function () use ($object) |
|
35 | + { |
|
35 | 36 | return $object; |
36 | 37 | }, |
37 | 38 | ]); |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | |
42 | 42 | public function testHandleWithHandleMethod(): void |
43 | 43 | { |
44 | - $object = new class($this) { |
|
44 | + $object = new class($this) |
|
45 | + { |
|
45 | 46 | private $testCase; |
46 | 47 | |
47 | 48 | public function __construct($testCase) |
@@ -64,7 +65,8 @@ discard block |
||
64 | 65 | |
65 | 66 | public function testHandleWithInvokeMethod(): void |
66 | 67 | { |
67 | - $object = new class($this) { |
|
68 | + $object = new class($this) |
|
69 | + { |
|
68 | 70 | private $testCase; |
69 | 71 | |
70 | 72 | public function __construct($testCase) |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public function __construct(array $directories) |
25 | 25 | { |
26 | - foreach ($directories as $name => $directory) { |
|
26 | + foreach ($directories as $name => $directory){ |
|
27 | 27 | $this->set($name, $directory); |
28 | 28 | } |
29 | 29 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function set(string $name, string $path): DirectoriesInterface |
43 | 43 | { |
44 | 44 | $path = str_replace(['\\', '//'], '/', $path); |
45 | - $this->directories[$name] = rtrim($path, '/') . '/'; |
|
45 | + $this->directories[$name] = rtrim($path, '/').'/'; |
|
46 | 46 | |
47 | 47 | return $this; |
48 | 48 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function get(string $name): string |
54 | 54 | { |
55 | - if (!$this->has($name)) { |
|
55 | + if (!$this->has($name)){ |
|
56 | 56 | throw new DirectoryException("Undefined directory '{$name}'"); |
57 | 57 | } |
58 | 58 |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | |
24 | 24 | public function __construct(array $directories) |
25 | 25 | { |
26 | - foreach ($directories as $name => $directory) { |
|
26 | + foreach ($directories as $name => $directory) |
|
27 | + { |
|
27 | 28 | $this->set($name, $directory); |
28 | 29 | } |
29 | 30 | } |
@@ -52,7 +53,8 @@ discard block |
||
52 | 53 | */ |
53 | 54 | public function get(string $name): string |
54 | 55 | { |
55 | - if (!$this->has($name)) { |
|
56 | + if (!$this->has($name)) |
|
57 | + { |
|
56 | 58 | throw new DirectoryException("Undefined directory '{$name}'"); |
57 | 59 | } |
58 | 60 |
@@ -18,22 +18,27 @@ discard block |
||
18 | 18 | |
19 | 19 | public function boot(Container $container, AbstractKernel $kernel): void |
20 | 20 | { |
21 | - $kernel->starting(static function (AbstractKernel $kernel) use ($container) { |
|
21 | + $kernel->starting(static function (AbstractKernel $kernel) use ($container) |
|
22 | + { |
|
22 | 23 | $container->bind('hij', 'foo'); |
23 | 24 | |
24 | - $kernel->starting(static function () use ($container) { |
|
25 | + $kernel->starting(static function () use ($container) |
|
26 | + { |
|
25 | 27 | $container->bind('ijk', 'foo'); |
26 | 28 | }); |
27 | 29 | }); |
28 | 30 | |
29 | - $kernel->started(function (AbstractKernel $kernel) use ($container) { |
|
31 | + $kernel->started(function (AbstractKernel $kernel) use ($container) |
|
32 | + { |
|
30 | 33 | $container->bind('jkl', 'foo'); |
31 | 34 | |
32 | - $kernel->starting(function () use ($container) { |
|
35 | + $kernel->starting(function () use ($container) |
|
36 | + { |
|
33 | 37 | $container->bind('klm', 'foo'); |
34 | 38 | }); |
35 | 39 | |
36 | - $kernel->started(function () use ($container) { |
|
40 | + $kernel->started(function () use ($container) |
|
41 | + { |
|
37 | 42 | $container->bind('lmn', 'foo'); |
38 | 43 | }); |
39 | 44 | }); |
@@ -44,11 +49,13 @@ discard block |
||
44 | 49 | public function start(ConfigurationBootloader $configuration, AbstractKernel $kernel, Container $container): void |
45 | 50 | { |
46 | 51 | // won't be executed |
47 | - $kernel->starting(function (AbstractKernel $kernel) use ($container) { |
|
52 | + $kernel->starting(function (AbstractKernel $kernel) use ($container) |
|
53 | + { |
|
48 | 54 | $container->bind('ghi', 'foo'); |
49 | 55 | }); |
50 | 56 | |
51 | - $kernel->started(function (AbstractKernel $kernel) use ($container) { |
|
57 | + $kernel->started(function (AbstractKernel $kernel) use ($container) |
|
58 | + { |
|
52 | 59 | $container->bind('mno', 'foo'); |
53 | 60 | }); |
54 | 61 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | 'root' => __DIR__, |
44 | 44 | ]); |
45 | 45 | |
46 | - $d = new class() implements DispatcherInterface { |
|
46 | + $d = new class() implements DispatcherInterface{ |
|
47 | 47 | public $fired = false; |
48 | 48 | |
49 | 49 | public function canServe(): bool |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | 'root' => __DIR__, |
73 | 73 | ]); |
74 | 74 | |
75 | - $d = new class() implements DispatcherInterface { |
|
75 | + $d = new class() implements DispatcherInterface{ |
|
76 | 76 | public function canServe(): bool |
77 | 77 | { |
78 | 78 | return true; |
@@ -110,19 +110,19 @@ discard block |
||
110 | 110 | 'root' => __DIR__, |
111 | 111 | ]); |
112 | 112 | |
113 | - $kernel->starting(static function (TestCore $core) { |
|
113 | + $kernel->starting(static function (TestCore $core){ |
|
114 | 114 | $core->getContainer()->bind('abc', 'foo'); |
115 | 115 | }); |
116 | 116 | |
117 | - $kernel->starting(static function (TestCore $core) { |
|
117 | + $kernel->starting(static function (TestCore $core){ |
|
118 | 118 | $core->getContainer()->bind('bcd', 'foo'); |
119 | 119 | }); |
120 | 120 | |
121 | - $kernel->started( static function (TestCore $core) { |
|
121 | + $kernel->started(static function (TestCore $core){ |
|
122 | 122 | $core->getContainer()->bind('cde', 'foo'); |
123 | 123 | }); |
124 | 124 | |
125 | - $kernel->started( static function (TestCore $core) { |
|
125 | + $kernel->started(static function (TestCore $core){ |
|
126 | 126 | $core->getContainer()->bind('def', 'foo'); |
127 | 127 | }); |
128 | 128 |
@@ -43,7 +43,8 @@ discard block |
||
43 | 43 | 'root' => __DIR__, |
44 | 44 | ]); |
45 | 45 | |
46 | - $d = new class() implements DispatcherInterface { |
|
46 | + $d = new class() implements DispatcherInterface |
|
47 | + { |
|
47 | 48 | public $fired = false; |
48 | 49 | |
49 | 50 | public function canServe(): bool |
@@ -72,7 +73,8 @@ discard block |
||
72 | 73 | 'root' => __DIR__, |
73 | 74 | ]); |
74 | 75 | |
75 | - $d = new class() implements DispatcherInterface { |
|
76 | + $d = new class() implements DispatcherInterface |
|
77 | + { |
|
76 | 78 | public function canServe(): bool |
77 | 79 | { |
78 | 80 | return true; |
@@ -110,19 +112,23 @@ discard block |
||
110 | 112 | 'root' => __DIR__, |
111 | 113 | ]); |
112 | 114 | |
113 | - $kernel->starting(static function (TestCore $core) { |
|
115 | + $kernel->starting(static function (TestCore $core) |
|
116 | + { |
|
114 | 117 | $core->getContainer()->bind('abc', 'foo'); |
115 | 118 | }); |
116 | 119 | |
117 | - $kernel->starting(static function (TestCore $core) { |
|
120 | + $kernel->starting(static function (TestCore $core) |
|
121 | + { |
|
118 | 122 | $core->getContainer()->bind('bcd', 'foo'); |
119 | 123 | }); |
120 | 124 | |
121 | - $kernel->started( static function (TestCore $core) { |
|
125 | + $kernel->started( static function (TestCore $core) |
|
126 | + { |
|
122 | 127 | $core->getContainer()->bind('cde', 'foo'); |
123 | 128 | }); |
124 | 129 | |
125 | - $kernel->started( static function (TestCore $core) { |
|
130 | + $kernel->started( static function (TestCore $core) |
|
131 | + { |
|
126 | 132 | $core->getContainer()->bind('def', 'foo'); |
127 | 133 | }); |
128 | 134 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | ActorProviderInterface $actorProvider, |
49 | 49 | TokenStorageInterface $tokenStorage, |
50 | 50 | TransportRegistry $transportRegistry |
51 | - ) { |
|
51 | + ){ |
|
52 | 52 | $this->scope = $scope; |
53 | 53 | $this->actorProvider = $actorProvider; |
54 | 54 | $this->tokenStorage = $tokenStorage; |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | |
76 | 76 | private function initContext(Request $request, AuthContextInterface $authContext): AuthContextInterface |
77 | 77 | { |
78 | - foreach ($this->transportRegistry->getTransports() as $name => $transport) { |
|
78 | + foreach ($this->transportRegistry->getTransports() as $name => $transport){ |
|
79 | 79 | $tokenID = $transport->fetchToken($request); |
80 | - if ($tokenID === null) { |
|
80 | + if ($tokenID === null){ |
|
81 | 81 | continue; |
82 | 82 | } |
83 | 83 | |
84 | 84 | $token = $this->tokenStorage->load($tokenID); |
85 | - if ($token === null) { |
|
85 | + if ($token === null){ |
|
86 | 86 | continue; |
87 | 87 | } |
88 | 88 | |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | |
97 | 97 | private function closeContext(Request $request, Response $response, AuthContextInterface $authContext): Response |
98 | 98 | { |
99 | - if ($authContext->getToken() === null) { |
|
99 | + if ($authContext->getToken() === null){ |
|
100 | 100 | return $response; |
101 | 101 | } |
102 | 102 | |
103 | 103 | $transport = $this->transportRegistry->getTransport($authContext->getTransport()); |
104 | 104 | |
105 | - if ($authContext->isClosed()) { |
|
105 | + if ($authContext->isClosed()){ |
|
106 | 106 | $this->tokenStorage->delete($authContext->getToken()); |
107 | 107 | |
108 | 108 | return $transport->removeToken( |
@@ -70,14 +70,17 @@ discard block |
||
70 | 70 | |
71 | 71 | private function initContext(Request $request, AuthContextInterface $authContext): AuthContextInterface |
72 | 72 | { |
73 | - foreach ($this->transportRegistry->getTransports() as $name => $transport) { |
|
73 | + foreach ($this->transportRegistry->getTransports() as $name => $transport) |
|
74 | + { |
|
74 | 75 | $tokenID = $transport->fetchToken($request); |
75 | - if ($tokenID === null) { |
|
76 | + if ($tokenID === null) |
|
77 | + { |
|
76 | 78 | continue; |
77 | 79 | } |
78 | 80 | |
79 | 81 | $token = $this->tokenStorage->load($tokenID); |
80 | - if ($token === null) { |
|
82 | + if ($token === null) |
|
83 | + { |
|
81 | 84 | continue; |
82 | 85 | } |
83 | 86 | |
@@ -91,13 +94,15 @@ discard block |
||
91 | 94 | |
92 | 95 | private function closeContext(Request $request, Response $response, AuthContextInterface $authContext): Response |
93 | 96 | { |
94 | - if ($authContext->getToken() === null) { |
|
97 | + if ($authContext->getToken() === null) |
|
98 | + { |
|
95 | 99 | return $response; |
96 | 100 | } |
97 | 101 | |
98 | 102 | $transport = $this->transportRegistry->getTransport($authContext->getTransport()); |
99 | 103 | |
100 | - if ($authContext->isClosed()) { |
|
104 | + if ($authContext->isClosed()) |
|
105 | + { |
|
101 | 106 | $this->tokenStorage->delete($authContext->getToken()); |
102 | 107 | |
103 | 108 | return $transport->removeToken( |
@@ -28,7 +28,7 @@ |
||
28 | 28 | /** @var AuthContextInterface $authContext */ |
29 | 29 | $authContext = $request->getAttribute(AuthMiddleware::ATTRIBUTE); |
30 | 30 | |
31 | - if ($authContext === null || $authContext->getActor() === null) { |
|
31 | + if ($authContext === null || $authContext->getActor() === null){ |
|
32 | 32 | return $this->denyAccess($request, $handler); |
33 | 33 | } |
34 | 34 |
@@ -28,7 +28,8 @@ |
||
28 | 28 | /** @var AuthContextInterface $authContext */ |
29 | 29 | $authContext = $request->getAttribute(AuthMiddleware::ATTRIBUTE); |
30 | 30 | |
31 | - if ($authContext === null || $authContext->getActor() === null) { |
|
31 | + if ($authContext === null || $authContext->getActor() === null) |
|
32 | + { |
|
32 | 33 | return $this->denyAccess($request, $handler); |
33 | 34 | } |
34 | 35 |
@@ -32,6 +32,6 @@ |
||
32 | 32 | |
33 | 33 | public function boot(ViewsBootloader $views): void |
34 | 34 | { |
35 | - $views->addDirectory('sendit', __DIR__ . '/../../views'); |
|
35 | + $views->addDirectory('sendit', __DIR__.'/../../views'); |
|
36 | 36 | } |
37 | 37 | } |