@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function __invoke(LogEvent $event) |
| 51 | 51 | { |
| 52 | - if (empty($this->output)) { |
|
| 52 | + if (empty($this->output)){ |
|
| 53 | 53 | return; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) { |
|
| 56 | + if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE){ |
|
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function enable(): self |
| 91 | 91 | { |
| 92 | - if (!empty($this->logs)) { |
|
| 92 | + if (!empty($this->logs)){ |
|
| 93 | 93 | $this->logs->addListener($this); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function disable(): self |
| 105 | 105 | { |
| 106 | - if (!empty($this->logs)) { |
|
| 106 | + if (!empty($this->logs)){ |
|
| 107 | 107 | $this->logs->removeListener($this); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | private function getChannel(string $channel): string |
| 128 | 128 | { |
| 129 | - if (!class_exists($channel, false)) { |
|
| 129 | + if (!class_exists($channel, false)){ |
|
| 130 | 130 | return "[{$channel}]"; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - try { |
|
| 133 | + try{ |
|
| 134 | 134 | $reflection = new \ReflectionClass($channel); |
| 135 | - } catch (\ReflectionException $e) { |
|
| 135 | + }catch (\ReflectionException $e){ |
|
| 136 | 136 | return $channel; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -146,10 +146,10 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | private function getMessage(bool $decorated, string $message) |
| 148 | 148 | { |
| 149 | - if (!$decorated) { |
|
| 149 | + if (!$decorated){ |
|
| 150 | 150 | return $message; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - return Color::GRAY . $message . Color::RESET; |
|
| 153 | + return Color::GRAY.$message.Color::RESET; |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | \ No newline at end of file |
@@ -49,11 +49,13 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function __invoke(LogEvent $event) |
| 51 | 51 | { |
| 52 | - if (empty($this->output)) { |
|
| 52 | + if (empty($this->output)) |
|
| 53 | + { |
|
| 53 | 54 | return; |
| 54 | 55 | } |
| 55 | 56 | |
| 56 | - if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) { |
|
| 57 | + if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) |
|
| 58 | + { |
|
| 57 | 59 | return; |
| 58 | 60 | } |
| 59 | 61 | |
@@ -89,7 +91,8 @@ discard block |
||
| 89 | 91 | */ |
| 90 | 92 | public function enable(): self |
| 91 | 93 | { |
| 92 | - if (!empty($this->logs)) { |
|
| 94 | + if (!empty($this->logs)) |
|
| 95 | + { |
|
| 93 | 96 | $this->logs->addListener($this); |
| 94 | 97 | } |
| 95 | 98 | |
@@ -103,7 +106,8 @@ discard block |
||
| 103 | 106 | */ |
| 104 | 107 | public function disable(): self |
| 105 | 108 | { |
| 106 | - if (!empty($this->logs)) { |
|
| 109 | + if (!empty($this->logs)) |
|
| 110 | + { |
|
| 107 | 111 | $this->logs->removeListener($this); |
| 108 | 112 | } |
| 109 | 113 | |
@@ -126,13 +130,17 @@ discard block |
||
| 126 | 130 | */ |
| 127 | 131 | private function getChannel(string $channel): string |
| 128 | 132 | { |
| 129 | - if (!class_exists($channel, false)) { |
|
| 133 | + if (!class_exists($channel, false)) |
|
| 134 | + { |
|
| 130 | 135 | return "[{$channel}]"; |
| 131 | 136 | } |
| 132 | 137 | |
| 133 | - try { |
|
| 138 | + try |
|
| 139 | + { |
|
| 134 | 140 | $reflection = new \ReflectionClass($channel); |
| 135 | - } catch (\ReflectionException $e) { |
|
| 141 | + } |
|
| 142 | + catch (\ReflectionException $e) |
|
| 143 | + { |
|
| 136 | 144 | return $channel; |
| 137 | 145 | } |
| 138 | 146 | |
@@ -146,7 +154,8 @@ discard block |
||
| 146 | 154 | */ |
| 147 | 155 | private function getMessage(bool $decorated, string $message) |
| 148 | 156 | { |
| 149 | - if (!$decorated) { |
|
| 157 | + if (!$decorated) |
|
| 158 | + { |
|
| 150 | 159 | return $message; |
| 151 | 160 | } |
| 152 | 161 | |
@@ -36,8 +36,8 @@ |
||
| 36 | 36 | public function locateCommands(): array |
| 37 | 37 | { |
| 38 | 38 | $commands = []; |
| 39 | - foreach ($this->classes->getClasses(\Symfony\Component\Console\Command\Command::class) as $class) { |
|
| 40 | - if ($class->isAbstract()) { |
|
| 39 | + foreach ($this->classes->getClasses(\Symfony\Component\Console\Command\Command::class) as $class){ |
|
| 40 | + if ($class->isAbstract()){ |
|
| 41 | 41 | continue; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -36,8 +36,10 @@ |
||
| 36 | 36 | public function locateCommands(): array |
| 37 | 37 | { |
| 38 | 38 | $commands = []; |
| 39 | - foreach ($this->classes->getClasses(\Symfony\Component\Console\Command\Command::class) as $class) { |
|
| 40 | - if ($class->isAbstract()) { |
|
| 39 | + foreach ($this->classes->getClasses(\Symfony\Component\Console\Command\Command::class) as $class) |
|
| 40 | + { |
|
| 41 | + if ($class->isAbstract()) |
|
| 42 | + { |
|
| 41 | 43 | continue; |
| 42 | 44 | } |
| 43 | 45 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | public function __construct( |
| 40 | 40 | EnvironmentInterface $env, |
| 41 | 41 | ContainerInterface $container |
| 42 | - ) { |
|
| 42 | + ){ |
|
| 43 | 43 | $this->env = $env; |
| 44 | 44 | $this->container = $container; |
| 45 | 45 | } |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | /** @var Console $console */ |
| 68 | 68 | $console = $this->container->get(Console::class); |
| 69 | 69 | |
| 70 | - try { |
|
| 70 | + try{ |
|
| 71 | 71 | $console->start($input ?? new ArgvInput(), $output); |
| 72 | - } catch (\Throwable $e) { |
|
| 72 | + }catch (\Throwable $e){ |
|
| 73 | 73 | $this->handleException($e, $output); |
| 74 | - } finally { |
|
| 74 | + }finally{ |
|
| 75 | 75 | $listener->disable(); |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | protected function handleException(\Throwable $e, OutputInterface $output) |
| 84 | 84 | { |
| 85 | - try { |
|
| 85 | + try{ |
|
| 86 | 86 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 87 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
| 87 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
| 88 | 88 | // no need to notify when unable to register an exception |
| 89 | 89 | } |
| 90 | 90 | |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | private function mapVerbosity(OutputInterface $output): int |
| 101 | 101 | { |
| 102 | - if ($output->isDebug() || $output->isVeryVerbose()) { |
|
| 102 | + if ($output->isDebug() || $output->isVeryVerbose()){ |
|
| 103 | 103 | return ConsoleHandler::VERBOSITY_DEBUG; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if ($output->isVerbose()) { |
|
| 106 | + if ($output->isVerbose()){ |
|
| 107 | 107 | return ConsoleHandler::VERBOSITY_VERBOSE; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -67,11 +67,16 @@ discard block |
||
| 67 | 67 | /** @var Console $console */ |
| 68 | 68 | $console = $this->container->get(Console::class); |
| 69 | 69 | |
| 70 | - try { |
|
| 70 | + try |
|
| 71 | + { |
|
| 71 | 72 | $console->start($input ?? new ArgvInput(), $output); |
| 72 | - } catch (\Throwable $e) { |
|
| 73 | + } |
|
| 74 | + catch (\Throwable $e) |
|
| 75 | + { |
|
| 73 | 76 | $this->handleException($e, $output); |
| 74 | - } finally { |
|
| 77 | + } |
|
| 78 | + finally |
|
| 79 | + { |
|
| 75 | 80 | $listener->disable(); |
| 76 | 81 | } |
| 77 | 82 | } |
@@ -82,9 +87,12 @@ discard block |
||
| 82 | 87 | */ |
| 83 | 88 | protected function handleException(\Throwable $e, OutputInterface $output) |
| 84 | 89 | { |
| 85 | - try { |
|
| 90 | + try |
|
| 91 | + { |
|
| 86 | 92 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 87 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
| 93 | + } |
|
| 94 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
| 95 | + { |
|
| 88 | 96 | // no need to notify when unable to register an exception |
| 89 | 97 | } |
| 90 | 98 | |
@@ -99,11 +107,13 @@ discard block |
||
| 99 | 107 | */ |
| 100 | 108 | private function mapVerbosity(OutputInterface $output): int |
| 101 | 109 | { |
| 102 | - if ($output->isDebug() || $output->isVeryVerbose()) { |
|
| 110 | + if ($output->isDebug() || $output->isVeryVerbose()) |
|
| 111 | + { |
|
| 103 | 112 | return ConsoleHandler::VERBOSITY_DEBUG; |
| 104 | 113 | } |
| 105 | 114 | |
| 106 | - if ($output->isVerbose()) { |
|
| 115 | + if ($output->isVerbose()) |
|
| 116 | + { |
|
| 107 | 117 | return ConsoleHandler::VERBOSITY_VERBOSE; |
| 108 | 118 | } |
| 109 | 119 | |
@@ -43,19 +43,19 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $runtimeDirectory = $this->dirs->get('runtime'); |
| 45 | 45 | |
| 46 | - if (!$this->files->exists($runtimeDirectory)) { |
|
| 46 | + if (!$this->files->exists($runtimeDirectory)){ |
|
| 47 | 47 | $this->files->ensureDirectory($runtimeDirectory); |
| 48 | 48 | $output->writeln("<comment>created</comment>"); |
| 49 | 49 | return; |
| 50 | - } else { |
|
| 50 | + }else{ |
|
| 51 | 51 | $output->writeln("<info>exists</info>"); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - foreach ($this->files->getFiles($runtimeDirectory) as $filename) { |
|
| 55 | - try { |
|
| 54 | + foreach ($this->files->getFiles($runtimeDirectory) as $filename){ |
|
| 55 | + try{ |
|
| 56 | 56 | $this->files->setPermissions($filename, FilesInterface::RUNTIME); |
| 57 | 57 | $this->files->setPermissions(dirname($filename), FilesInterface::RUNTIME); |
| 58 | - } catch (\Throwable $e) { |
|
| 58 | + }catch (\Throwable $e){ |
|
| 59 | 59 | $output->writeln(sprintf( |
| 60 | 60 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>", |
| 61 | 61 | $this->files->relativePath($filename, $runtimeDirectory), |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | continue; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if ($output->isVerbose()) { |
|
| 67 | + if ($output->isVerbose()){ |
|
| 68 | 68 | $output->writeln(sprintf( |
| 69 | 69 | "<fg=green>[updated]</fg=green> `%s`", |
| 70 | 70 | $this->files->relativePath($filename, $runtimeDirectory) |
@@ -43,19 +43,26 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $runtimeDirectory = $this->dirs->get('runtime'); |
| 45 | 45 | |
| 46 | - if (!$this->files->exists($runtimeDirectory)) { |
|
| 46 | + if (!$this->files->exists($runtimeDirectory)) |
|
| 47 | + { |
|
| 47 | 48 | $this->files->ensureDirectory($runtimeDirectory); |
| 48 | 49 | $output->writeln("<comment>created</comment>"); |
| 49 | 50 | return; |
| 50 | - } else { |
|
| 51 | + } |
|
| 52 | + else |
|
| 53 | + { |
|
| 51 | 54 | $output->writeln("<info>exists</info>"); |
| 52 | 55 | } |
| 53 | 56 | |
| 54 | - foreach ($this->files->getFiles($runtimeDirectory) as $filename) { |
|
| 55 | - try { |
|
| 57 | + foreach ($this->files->getFiles($runtimeDirectory) as $filename) |
|
| 58 | + { |
|
| 59 | + try |
|
| 60 | + { |
|
| 56 | 61 | $this->files->setPermissions($filename, FilesInterface::RUNTIME); |
| 57 | 62 | $this->files->setPermissions(dirname($filename), FilesInterface::RUNTIME); |
| 58 | - } catch (\Throwable $e) { |
|
| 63 | + } |
|
| 64 | + catch (\Throwable $e) |
|
| 65 | + { |
|
| 59 | 66 | $output->writeln(sprintf( |
| 60 | 67 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>", |
| 61 | 68 | $this->files->relativePath($filename, $runtimeDirectory), |
@@ -64,7 +71,8 @@ discard block |
||
| 64 | 71 | continue; |
| 65 | 72 | } |
| 66 | 73 | |
| 67 | - if ($output->isVerbose()) { |
|
| 74 | + if ($output->isVerbose()) |
|
| 75 | + { |
|
| 68 | 76 | $output->writeln(sprintf( |
| 69 | 77 | "<fg=green>[updated]</fg=green> `%s`", |
| 70 | 78 | $this->files->relativePath($filename, $runtimeDirectory) |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | bool $suppressErrors, |
| 45 | 45 | RendererInterface $renderer, |
| 46 | 46 | SnapshotterInterface $snapshots = null |
| 47 | - ) { |
|
| 47 | + ){ |
|
| 48 | 48 | $this->suppressErrors = $suppressErrors; |
| 49 | 49 | $this->renderer = $renderer; |
| 50 | 50 | $this->snapshotter = $snapshots; |
@@ -57,20 +57,20 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function process(Request $request, Handler $handler): Response |
| 59 | 59 | { |
| 60 | - try { |
|
| 60 | + try{ |
|
| 61 | 61 | return $handler->handle($request); |
| 62 | - } catch (ClientException|RouteNotFoundException $e) { |
|
| 63 | - if ($e instanceof ClientException) { |
|
| 62 | + }catch (ClientException | RouteNotFoundException $e){ |
|
| 63 | + if ($e instanceof ClientException){ |
|
| 64 | 64 | $code = $e->getCode(); |
| 65 | - } else { |
|
| 65 | + }else{ |
|
| 66 | 66 | $code = 404; |
| 67 | 67 | } |
| 68 | - } catch (\Throwable $e) { |
|
| 69 | - if (!$this->suppressErrors) { |
|
| 68 | + }catch (\Throwable $e){ |
|
| 69 | + if (!$this->suppressErrors){ |
|
| 70 | 70 | throw $e; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ($this->snapshotter !== null) { |
|
| 73 | + if ($this->snapshotter !== null){ |
|
| 74 | 74 | $this->snapshotter->register($e); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -57,20 +57,30 @@ |
||
| 57 | 57 | */ |
| 58 | 58 | public function process(Request $request, Handler $handler): Response |
| 59 | 59 | { |
| 60 | - try { |
|
| 60 | + try |
|
| 61 | + { |
|
| 61 | 62 | return $handler->handle($request); |
| 62 | - } catch (ClientException|RouteNotFoundException $e) { |
|
| 63 | - if ($e instanceof ClientException) { |
|
| 63 | + } |
|
| 64 | + catch (ClientException|RouteNotFoundException $e) |
|
| 65 | + { |
|
| 66 | + if ($e instanceof ClientException) |
|
| 67 | + { |
|
| 64 | 68 | $code = $e->getCode(); |
| 65 | - } else { |
|
| 69 | + } |
|
| 70 | + else |
|
| 71 | + { |
|
| 66 | 72 | $code = 404; |
| 67 | 73 | } |
| 68 | - } catch (\Throwable $e) { |
|
| 69 | - if (!$this->suppressErrors) { |
|
| 74 | + } |
|
| 75 | + catch (\Throwable $e) |
|
| 76 | + { |
|
| 77 | + if (!$this->suppressErrors) |
|
| 78 | + { |
|
| 70 | 79 | throw $e; |
| 71 | 80 | } |
| 72 | 81 | |
| 73 | - if ($this->snapshotter !== null) { |
|
| 82 | + if ($this->snapshotter !== null) |
|
| 83 | + { |
|
| 74 | 84 | $this->snapshotter->register($e); |
| 75 | 85 | } |
| 76 | 86 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | HttpConfig $httpConfig, |
| 52 | 52 | SessionFactory $factory, |
| 53 | 53 | ScopeInterface $scope |
| 54 | - ) { |
|
| 54 | + ){ |
|
| 55 | 55 | $this->config = $config; |
| 56 | 56 | $this->httpConfig = $httpConfig; |
| 57 | 57 | $this->factory = $factory; |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | $this->fetchID($request) |
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | - try { |
|
| 72 | + try{ |
|
| 73 | 73 | $response = $this->scope->runScope( |
| 74 | 74 | [SessionInterface::class => $session], |
| 75 | 75 | function () use ($session, $request, $handler) { |
| 76 | 76 | return $handler->handle($request->withAttribute(static::ATTRIBUTE, $session)); |
| 77 | 77 | } |
| 78 | 78 | ); |
| 79 | - } catch (\Throwable $e) { |
|
| 79 | + }catch (\Throwable $e){ |
|
| 80 | 80 | $session->abort(); |
| 81 | 81 | |
| 82 | 82 | throw new $e; |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | Request $request, |
| 97 | 97 | Response $response |
| 98 | 98 | ): Response { |
| 99 | - if (!$session->isStarted()) { |
|
| 99 | + if (!$session->isStarted()){ |
|
| 100 | 100 | return $response; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $session->commit(); |
| 104 | 104 | |
| 105 | 105 | //SID changed |
| 106 | - if ($this->fetchID($request) != $session->getID()) { |
|
| 106 | + if ($this->fetchID($request) != $session->getID()){ |
|
| 107 | 107 | return $this->withCookie($request, $response, $session->getID()); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | protected function fetchID(Request $request): ?string |
| 121 | 121 | { |
| 122 | 122 | $cookies = $request->getCookieParams(); |
| 123 | - if (empty($cookies[$this->config->getCookie()])) { |
|
| 123 | + if (empty($cookies[$this->config->getCookie()])){ |
|
| 124 | 124 | return null; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | protected function clientSignature(Request $request): string |
| 154 | 154 | { |
| 155 | 155 | $signature = ''; |
| 156 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
| 157 | - $signature .= $request->getHeaderLine($header) . ';'; |
|
| 156 | + foreach (static::SIGNATURE_HEADERS as $header){ |
|
| 157 | + $signature .= $request->getHeaderLine($header).';'; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | return hash('sha256', $signature); |
@@ -69,14 +69,18 @@ discard block |
||
| 69 | 69 | $this->fetchID($request) |
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | - try { |
|
| 72 | + try |
|
| 73 | + { |
|
| 73 | 74 | $response = $this->scope->runScope( |
| 74 | 75 | [SessionInterface::class => $session], |
| 75 | - function () use ($session, $request, $handler) { |
|
| 76 | + function () use ($session, $request, $handler) |
|
| 77 | + { |
|
| 76 | 78 | return $handler->handle($request->withAttribute(static::ATTRIBUTE, $session)); |
| 77 | 79 | } |
| 78 | 80 | ); |
| 79 | - } catch (\Throwable $e) { |
|
| 81 | + } |
|
| 82 | + catch (\Throwable $e) |
|
| 83 | + { |
|
| 80 | 84 | $session->abort(); |
| 81 | 85 | |
| 82 | 86 | throw new $e; |
@@ -96,14 +100,16 @@ discard block |
||
| 96 | 100 | Request $request, |
| 97 | 101 | Response $response |
| 98 | 102 | ): Response { |
| 99 | - if (!$session->isStarted()) { |
|
| 103 | + if (!$session->isStarted()) |
|
| 104 | + { |
|
| 100 | 105 | return $response; |
| 101 | 106 | } |
| 102 | 107 | |
| 103 | 108 | $session->commit(); |
| 104 | 109 | |
| 105 | 110 | //SID changed |
| 106 | - if ($this->fetchID($request) != $session->getID()) { |
|
| 111 | + if ($this->fetchID($request) != $session->getID()) |
|
| 112 | + { |
|
| 107 | 113 | return $this->withCookie($request, $response, $session->getID()); |
| 108 | 114 | } |
| 109 | 115 | |
@@ -120,7 +126,8 @@ discard block |
||
| 120 | 126 | protected function fetchID(Request $request): ?string |
| 121 | 127 | { |
| 122 | 128 | $cookies = $request->getCookieParams(); |
| 123 | - if (empty($cookies[$this->config->getCookie()])) { |
|
| 129 | + if (empty($cookies[$this->config->getCookie()])) |
|
| 130 | + { |
|
| 124 | 131 | return null; |
| 125 | 132 | } |
| 126 | 133 | |
@@ -153,7 +160,8 @@ discard block |
||
| 153 | 160 | protected function clientSignature(Request $request): string |
| 154 | 161 | { |
| 155 | 162 | $signature = ''; |
| 156 | - foreach (static::SIGNATURE_HEADERS as $header) { |
|
| 163 | + foreach (static::SIGNATURE_HEADERS as $header) |
|
| 164 | + { |
|
| 157 | 165 | $signature .= $request->getHeaderLine($header) . ';'; |
| 158 | 166 | } |
| 159 | 167 | |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | $http = $this->container->get(HttpCore::class); |
| 60 | 60 | $emitter = $this->container->get(EmitterInterface::class); |
| 61 | 61 | |
| 62 | - try { |
|
| 62 | + try{ |
|
| 63 | 63 | $response = $http->handle($this->initRequest()); |
| 64 | 64 | $emitter->emit($response); |
| 65 | - } catch (\Throwable $e) { |
|
| 65 | + }catch (\Throwable $e){ |
|
| 66 | 66 | $this->handleException($emitter, $e); |
| 67 | - } finally { |
|
| 67 | + }finally{ |
|
| 68 | 68 | $this->finalizer->finalize(false); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
| 87 | 87 | |
| 88 | - try { |
|
| 88 | + try{ |
|
| 89 | 89 | /** @var SnapshotInterface $snapshot */ |
| 90 | 90 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 91 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
| 91 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
| 92 | 92 | // nothing to report |
| 93 | 93 | } |
| 94 | 94 | |
@@ -59,12 +59,17 @@ discard block |
||
| 59 | 59 | $http = $this->container->get(HttpCore::class); |
| 60 | 60 | $emitter = $this->container->get(EmitterInterface::class); |
| 61 | 61 | |
| 62 | - try { |
|
| 62 | + try |
|
| 63 | + { |
|
| 63 | 64 | $response = $http->handle($this->initRequest()); |
| 64 | 65 | $emitter->emit($response); |
| 65 | - } catch (\Throwable $e) { |
|
| 66 | + } |
|
| 67 | + catch (\Throwable $e) |
|
| 68 | + { |
|
| 66 | 69 | $this->handleException($emitter, $e); |
| 67 | - } finally { |
|
| 70 | + } |
|
| 71 | + finally |
|
| 72 | + { |
|
| 68 | 73 | $this->finalizer->finalize(false); |
| 69 | 74 | } |
| 70 | 75 | } |
@@ -85,10 +90,13 @@ discard block |
||
| 85 | 90 | { |
| 86 | 91 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
| 87 | 92 | |
| 88 | - try { |
|
| 93 | + try |
|
| 94 | + { |
|
| 89 | 95 | /** @var SnapshotInterface $snapshot */ |
| 90 | 96 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 91 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
| 97 | + } |
|
| 98 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
| 99 | + { |
|
| 92 | 100 | // nothing to report |
| 93 | 101 | } |
| 94 | 102 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | FinalizerInterface $finalizer, |
| 48 | 48 | ContainerInterface $container, |
| 49 | 49 | FactoryInterface $factory |
| 50 | - ) { |
|
| 50 | + ){ |
|
| 51 | 51 | $this->env = $env; |
| 52 | 52 | $this->finalizer = $finalizer; |
| 53 | 53 | $this->container = $container; |
@@ -73,12 +73,12 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | /** @var HttpCore $http */ |
| 75 | 75 | $http = $this->container->get(HttpCore::class); |
| 76 | - while ($request = $client->acceptRequest()) { |
|
| 77 | - try { |
|
| 76 | + while ($request = $client->acceptRequest()){ |
|
| 77 | + try{ |
|
| 78 | 78 | $client->respond($http->handle($request)); |
| 79 | - } catch (\Throwable $e) { |
|
| 79 | + }catch (\Throwable $e){ |
|
| 80 | 80 | $this->handleException($client, $e); |
| 81 | - } finally { |
|
| 81 | + }finally{ |
|
| 82 | 82 | $this->finalizer->finalize(false); |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
| 94 | 94 | |
| 95 | - try { |
|
| 95 | + try{ |
|
| 96 | 96 | /** @var SnapshotInterface $snapshot */ |
| 97 | 97 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
| 98 | 98 | error_log($snapshot->getMessage()); |
| 99 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
| 99 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
| 100 | 100 | error_log($handler->getMessage($e)); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -73,12 +73,18 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | /** @var HttpCore $http */ |
| 75 | 75 | $http = $this->container->get(HttpCore::class); |
| 76 | - while ($request = $client->acceptRequest()) { |
|
| 77 | - try { |
|
| 76 | + while ($request = $client->acceptRequest()) |
|
| 77 | + { |
|
| 78 | + try |
|
| 79 | + { |
|
| 78 | 80 | $client->respond($http->handle($request)); |
| 79 | - } catch (\Throwable $e) { |
|
| 81 | + } |
|
| 82 | + catch (\Throwable $e) |
|
| 83 | + { |
|
| 80 | 84 | $this->handleException($client, $e); |
| 81 | - } finally { |
|
| 85 | + } |
|
| 86 | + finally |
|
| 87 | + { |
|
| 82 | 88 | $this->finalizer->finalize(false); |
| 83 | 89 | } |
| 84 | 90 | } |
@@ -92,11 +98,14 @@ discard block |
||
| 92 | 98 | { |
| 93 | 99 | $handler = new HtmlHandler(HtmlHandler::INVERTED); |
| 94 | 100 | |
| 95 | - try { |
|
| 101 | + try |
|
| 102 | + { |
|
| 96 | 103 | /** @var SnapshotInterface $snapshot */ |
| 97 | 104 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
| 98 | 105 | error_log($snapshot->getMessage()); |
| 99 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
| 106 | + } |
|
| 107 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
| 108 | + { |
|
| 100 | 109 | error_log($handler->getMessage($e)); |
| 101 | 110 | } |
| 102 | 111 | |
@@ -46,7 +46,8 @@ |
||
| 46 | 46 | //We are not forcing locale for now |
| 47 | 47 | return $source->withCode(preg_replace_callback( |
| 48 | 48 | self::REGEXP, |
| 49 | - function ($matches) use ($domain, $context) { |
|
| 49 | + function ($matches) use ($domain, $context) |
|
| 50 | + { |
|
| 50 | 51 | return $this->translator->trans( |
| 51 | 52 | $matches[1], |
| 52 | 53 | [], |