@@ -87,8 +87,8 @@ |
||
87 | 87 | $registry = new TransportRegistry(); |
88 | 88 | $registry->setDefaultTransport($config->getDefaultTransport()); |
89 | 89 | |
90 | - foreach ($config->getTransports() as $name => $transport) { |
|
91 | - if ($transport instanceof Autowire) { |
|
90 | + foreach ($config->getTransports() as $name => $transport){ |
|
91 | + if ($transport instanceof Autowire){ |
|
92 | 92 | $transport = $transport->resolve($factory); |
93 | 93 | } |
94 | 94 |
@@ -87,8 +87,10 @@ |
||
87 | 87 | $registry = new TransportRegistry(); |
88 | 88 | $registry->setDefaultTransport($config->getDefaultTransport()); |
89 | 89 | |
90 | - foreach ($config->getTransports() as $name => $transport) { |
|
91 | - if ($transport instanceof Autowire) { |
|
90 | + foreach ($config->getTransports() as $name => $transport) |
|
91 | + { |
|
92 | + if ($transport instanceof Autowire) |
|
93 | + { |
|
92 | 94 | $transport = $transport->resolve($factory); |
93 | 95 | } |
94 | 96 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | private function actor(AuthContextInterface $context): ActorInterface |
39 | 39 | { |
40 | 40 | $actor = $context->getActor(); |
41 | - if ($actor instanceof ActorInterface) { |
|
41 | + if ($actor instanceof ActorInterface){ |
|
42 | 42 | return $actor; |
43 | 43 | } |
44 | 44 |
@@ -38,7 +38,8 @@ |
||
38 | 38 | private function actor(AuthContextInterface $context): ActorInterface |
39 | 39 | { |
40 | 40 | $actor = $context->getActor(); |
41 | - if ($actor instanceof ActorInterface) { |
|
41 | + if ($actor instanceof ActorInterface) |
|
42 | + { |
|
42 | 43 | return $actor; |
43 | 44 | } |
44 | 45 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | CookiesConfig $cookiesConfig, |
61 | 61 | SessionFactory $factory, |
62 | 62 | ScopeInterface $scope |
63 | - ) { |
|
63 | + ){ |
|
64 | 64 | $this->config = $config; |
65 | 65 | $this->httpConfig = $httpConfig; |
66 | 66 | $this->cookiesConfig = $cookiesConfig; |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | $this->fetchID($request) |
80 | 80 | ); |
81 | 81 | |
82 | - try { |
|
82 | + try{ |
|
83 | 83 | $response = $this->scope->runScope( |
84 | 84 | [SessionInterface::class => $session], |
85 | 85 | function () use ($handler, $request, $session) { |
86 | 86 | return $handler->handle($request->withAttribute(static::ATTRIBUTE, $session)); |
87 | 87 | } |
88 | 88 | ); |
89 | - } catch (\Throwable $e) { |
|
89 | + }catch (\Throwable $e){ |
|
90 | 90 | $session->abort(); |
91 | 91 | throw $e; |
92 | 92 | } |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | Request $request, |
106 | 106 | Response $response |
107 | 107 | ): Response { |
108 | - if (!$session->isStarted()) { |
|
108 | + if (!$session->isStarted()){ |
|
109 | 109 | return $response; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $session->commit(); |
113 | 113 | |
114 | 114 | //SID changed |
115 | - if ($this->fetchID($request) != $session->getID()) { |
|
115 | + if ($this->fetchID($request) != $session->getID()){ |
|
116 | 116 | return $this->withCookie($request, $response, $session->getID()); |
117 | 117 | } |
118 | 118 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | protected function fetchID(Request $request): ?string |
130 | 130 | { |
131 | 131 | $cookies = $request->getCookieParams(); |
132 | - if (empty($cookies[$this->config->getCookie()])) { |
|
132 | + if (empty($cookies[$this->config->getCookie()])){ |
|
133 | 133 | return null; |
134 | 134 | } |
135 | 135 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | protected function clientSignature(Request $request): string |
163 | 163 | { |
164 | 164 | $signature = ''; |
165 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
166 | - $signature .= $request->getHeaderLine($header) . ';'; |
|
165 | + foreach (static::SIGNATURE_HEADERS as $header){ |
|
166 | + $signature .= $request->getHeaderLine($header).';'; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | return hash('sha256', $signature); |
@@ -79,14 +79,18 @@ discard block |
||
79 | 79 | $this->fetchID($request) |
80 | 80 | ); |
81 | 81 | |
82 | - try { |
|
82 | + try |
|
83 | + { |
|
83 | 84 | $response = $this->scope->runScope( |
84 | 85 | [SessionInterface::class => $session], |
85 | - function () use ($handler, $request, $session) { |
|
86 | + function () use ($handler, $request, $session) |
|
87 | + { |
|
86 | 88 | return $handler->handle($request->withAttribute(static::ATTRIBUTE, $session)); |
87 | 89 | } |
88 | 90 | ); |
89 | - } catch (\Throwable $e) { |
|
91 | + } |
|
92 | + catch (\Throwable $e) |
|
93 | + { |
|
90 | 94 | $session->abort(); |
91 | 95 | throw $e; |
92 | 96 | } |
@@ -105,14 +109,16 @@ discard block |
||
105 | 109 | Request $request, |
106 | 110 | Response $response |
107 | 111 | ): Response { |
108 | - if (!$session->isStarted()) { |
|
112 | + if (!$session->isStarted()) |
|
113 | + { |
|
109 | 114 | return $response; |
110 | 115 | } |
111 | 116 | |
112 | 117 | $session->commit(); |
113 | 118 | |
114 | 119 | //SID changed |
115 | - if ($this->fetchID($request) != $session->getID()) { |
|
120 | + if ($this->fetchID($request) != $session->getID()) |
|
121 | + { |
|
116 | 122 | return $this->withCookie($request, $response, $session->getID()); |
117 | 123 | } |
118 | 124 | |
@@ -129,7 +135,8 @@ discard block |
||
129 | 135 | protected function fetchID(Request $request): ?string |
130 | 136 | { |
131 | 137 | $cookies = $request->getCookieParams(); |
132 | - if (empty($cookies[$this->config->getCookie()])) { |
|
138 | + if (empty($cookies[$this->config->getCookie()])) |
|
139 | + { |
|
133 | 140 | return null; |
134 | 141 | } |
135 | 142 | |
@@ -162,7 +169,8 @@ discard block |
||
162 | 169 | protected function clientSignature(Request $request): string |
163 | 170 | { |
164 | 171 | $signature = ''; |
165 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
172 | + foreach (static::SIGNATURE_HEADERS as $header) |
|
173 | + { |
|
166 | 174 | $signature .= $request->getHeaderLine($header) . ';'; |
167 | 175 | } |
168 | 176 |
@@ -49,7 +49,7 @@ |
||
49 | 49 | new Route('/auth/<action>', new Controller(AuthController::class)) |
50 | 50 | ); |
51 | 51 | |
52 | - $views->addDirectory('custom', __DIR__ . '/../../views/custom/'); |
|
52 | + $views->addDirectory('custom', __DIR__.'/../../views/custom/'); |
|
53 | 53 | $views->addEngine(TestEngine::class); |
54 | 54 | |
55 | 55 | $validation->addAlias('aliased', 'notEmpty'); |
@@ -43,7 +43,7 @@ |
||
43 | 43 | |
44 | 44 | $memory->saveData('cycle', $schema); |
45 | 45 | |
46 | - if ($show->hasChanges()) { |
|
46 | + if ($show->hasChanges()){ |
|
47 | 47 | $this->writeln("\n<info>ORM Schema has been synchronized</info>"); |
48 | 48 | } |
49 | 49 | } |
@@ -43,7 +43,8 @@ |
||
43 | 43 | |
44 | 44 | $memory->saveData('cycle', $schema); |
45 | 45 | |
46 | - if ($show->hasChanges()) { |
|
46 | + if ($show->hasChanges()) |
|
47 | + { |
|
47 | 48 | $this->writeln("\n<info>ORM Schema has been synchronized</info>"); |
48 | 49 | } |
49 | 50 | } |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | public function getGenerators(): array |
86 | 86 | { |
87 | 87 | $result = []; |
88 | - foreach ($this->generators as $group) { |
|
89 | - foreach ($group as $generator) { |
|
90 | - if (is_object($generator) && !$generator instanceof Container\Autowire) { |
|
88 | + foreach ($this->generators as $group){ |
|
89 | + foreach ($group as $generator){ |
|
90 | + if (is_object($generator) && !$generator instanceof Container\Autowire){ |
|
91 | 91 | $result[] = $generator; |
92 | - } else { |
|
92 | + }else{ |
|
93 | 93 | $result[] = $this->container->get($generator); |
94 | 94 | } |
95 | 95 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | protected function schema(MemoryInterface $memory): SchemaInterface |
106 | 106 | { |
107 | 107 | $schema = $memory->loadData('cycle'); |
108 | - if (is_null($schema)) { |
|
108 | + if (is_null($schema)){ |
|
109 | 109 | $schema = (new Compiler())->compile( |
110 | 110 | $this->container->get(Registry::class), |
111 | 111 | $this->getGenerators() |
@@ -85,11 +85,16 @@ discard block |
||
85 | 85 | public function getGenerators(): array |
86 | 86 | { |
87 | 87 | $result = []; |
88 | - foreach ($this->generators as $group) { |
|
89 | - foreach ($group as $generator) { |
|
90 | - if (is_object($generator) && !$generator instanceof Container\Autowire) { |
|
88 | + foreach ($this->generators as $group) |
|
89 | + { |
|
90 | + foreach ($group as $generator) |
|
91 | + { |
|
92 | + if (is_object($generator) && !$generator instanceof Container\Autowire) |
|
93 | + { |
|
91 | 94 | $result[] = $generator; |
92 | - } else { |
|
95 | + } |
|
96 | + else |
|
97 | + { |
|
93 | 98 | $result[] = $this->container->get($generator); |
94 | 99 | } |
95 | 100 | } |
@@ -105,7 +110,8 @@ discard block |
||
105 | 110 | protected function schema(MemoryInterface $memory): SchemaInterface |
106 | 111 | { |
107 | 112 | $schema = $memory->loadData('cycle'); |
108 | - if (is_null($schema)) { |
|
113 | + if (is_null($schema)) |
|
114 | + { |
|
109 | 115 | $schema = (new Compiler())->compile( |
110 | 116 | $this->container->get(Registry::class), |
111 | 117 | $this->getGenerators() |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | public function input(InputScope $i) |
50 | 50 | { |
51 | - return 'value: ' . $i->withPrefix('section')->getValue('query', 'value'); |
|
51 | + return 'value: '.$i->withPrefix('section')->getValue('query', 'value'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public function error(): void |
@@ -38,7 +38,7 @@ |
||
38 | 38 | { |
39 | 39 | $core = new InterceptableCore($core); |
40 | 40 | |
41 | - foreach (static::INTERCEPTORS as $interceptor) { |
|
41 | + foreach (static::INTERCEPTORS as $interceptor){ |
|
42 | 42 | $core->addInterceptor($container->get($interceptor)); |
43 | 43 | } |
44 | 44 |
@@ -38,7 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | $core = new InterceptableCore($core); |
40 | 40 | |
41 | - foreach (static::INTERCEPTORS as $interceptor) { |
|
41 | + foreach (static::INTERCEPTORS as $interceptor) |
|
42 | + { |
|
42 | 43 | $core->addInterceptor($container->get($interceptor)); |
43 | 44 | } |
44 | 45 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function do(GuardInterface $guard) |
30 | 30 | { |
31 | - if (!$guard->allows('do')) { |
|
31 | + if (!$guard->allows('do')){ |
|
32 | 32 | throw new ControllerException("Unauthorized permission 'do'", ControllerException::FORBIDDEN); |
33 | 33 | } |
34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | public function token(AuthContextInterface $authContext) |
39 | 39 | { |
40 | - if ($authContext->getToken() !== null) { |
|
40 | + if ($authContext->getToken() !== null){ |
|
41 | 41 | return $authContext->getToken()->getID(); |
42 | 42 | } |
43 | 43 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function token2() |
57 | 57 | { |
58 | - if ($this->auth->getToken() !== null) { |
|
58 | + if ($this->auth->getToken() !== null){ |
|
59 | 59 | return $this->auth->getToken()->getID(); |
60 | 60 | } |
61 | 61 |
@@ -26,10 +26,12 @@ discard block |
||
26 | 26 | $this->auth = $auth; |
27 | 27 | } |
28 | 28 | |
29 | - public function do(GuardInterface $guard) |
|
29 | + public function do{ |
|
30 | + (GuardInterface $guard) |
|
30 | 31 | { |
31 | 32 | if (!$guard->allows('do')) { |
32 | 33 | throw new ControllerException("Unauthorized permission 'do'", ControllerException::FORBIDDEN); |
34 | + } |
|
33 | 35 | } |
34 | 36 | |
35 | 37 | return 'ok'; |
@@ -37,7 +39,8 @@ discard block |
||
37 | 39 | |
38 | 40 | public function token(AuthContextInterface $authContext) |
39 | 41 | { |
40 | - if ($authContext->getToken() !== null) { |
|
42 | + if ($authContext->getToken() !== null) |
|
43 | + { |
|
41 | 44 | return $authContext->getToken()->getID(); |
42 | 45 | } |
43 | 46 | |
@@ -55,7 +58,8 @@ discard block |
||
55 | 58 | |
56 | 59 | public function token2() |
57 | 60 | { |
58 | - if ($this->auth->getToken() !== null) { |
|
61 | + if ($this->auth->getToken() !== null) |
|
62 | + { |
|
59 | 63 | return $this->auth->getToken()->getID(); |
60 | 64 | } |
61 | 65 |