@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | $services = $locator->getServices(); |
| 27 | 27 | |
| 28 | - if ($services === []) { |
|
| 28 | + if ($services === []){ |
|
| 29 | 29 | $this->writeln('<comment>No GRPC services were found.</comment>'); |
| 30 | 30 | return; |
| 31 | 31 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | 'File:', |
| 37 | 37 | ]); |
| 38 | 38 | |
| 39 | - foreach ($services as $interface => $instance) { |
|
| 39 | + foreach ($services as $interface => $instance){ |
|
| 40 | 40 | $grid->addRow([ |
| 41 | 41 | $interface::NAME, |
| 42 | 42 | get_class($instance), |
@@ -25,7 +25,8 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | $services = $locator->getServices(); |
| 27 | 27 | |
| 28 | - if ($services === []) { |
|
| 28 | + if ($services === []) |
|
| 29 | + { |
|
| 29 | 30 | $this->writeln('<comment>No GRPC services were found.</comment>'); |
| 30 | 31 | return; |
| 31 | 32 | } |
@@ -36,7 +37,8 @@ discard block |
||
| 36 | 37 | 'File:', |
| 37 | 38 | ]); |
| 38 | 39 | |
| 39 | - foreach ($services as $interface => $instance) { |
|
| 40 | + foreach ($services as $interface => $instance) |
|
| 41 | + { |
|
| 40 | 42 | $grid->addRow([ |
| 41 | 43 | $interface::NAME, |
| 42 | 44 | get_class($instance), |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | public function perform(KernelInterface $kernel, FilesInterface $files, DirectoriesInterface $dirs): void |
| 41 | 41 | { |
| 42 | 42 | $protoFile = $this->argument('proto'); |
| 43 | - if (!file_exists($protoFile)) { |
|
| 43 | + if (!file_exists($protoFile)){ |
|
| 44 | 44 | $this->sprintf('<error>File `%s` not found.</error>', $protoFile); |
| 45 | 45 | return; |
| 46 | 46 | } |
@@ -53,19 +53,19 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $this->sprintf("<info>Compiling <fg=cyan>`%s`</fg=cyan>:</info>\n", $protoFile); |
| 55 | 55 | |
| 56 | - try { |
|
| 56 | + try{ |
|
| 57 | 57 | $result = $compiler->compile($protoFile); |
| 58 | - } catch (\Throwable $e) { |
|
| 58 | + }catch (\Throwable $e){ |
|
| 59 | 59 | $this->sprintf("<error>Error:</error> <fg=red>%s</fg=red>\n", $e->getMessage()); |
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - if ($result === []) { |
|
| 63 | + if ($result === []){ |
|
| 64 | 64 | $this->sprintf("<info>No files were generated.</info>\n", $protoFile); |
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - foreach ($result as $file) { |
|
| 68 | + foreach ($result as $file){ |
|
| 69 | 69 | $this->sprintf( |
| 70 | 70 | "<fg=green>•</fg=green> %s%s%s\n", |
| 71 | 71 | Color::LIGHT_WHITE, |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | protected function getPath(KernelInterface $kernel): string |
| 85 | 85 | { |
| 86 | 86 | $path = $this->argument('namespace'); |
| 87 | - if ($path !== 'auto') { |
|
| 87 | + if ($path !== 'auto'){ |
|
| 88 | 88 | return $path; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | protected function getNamespace(KernelInterface $kernel): string |
| 103 | 103 | { |
| 104 | 104 | $namespace = $this->argument('namespace'); |
| 105 | - if ($namespace !== 'auto') { |
|
| 105 | + if ($namespace !== 'auto'){ |
|
| 106 | 106 | return $namespace; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -40,7 +40,8 @@ discard block |
||
| 40 | 40 | public function perform(KernelInterface $kernel, FilesInterface $files, DirectoriesInterface $dirs): void |
| 41 | 41 | { |
| 42 | 42 | $protoFile = $this->argument('proto'); |
| 43 | - if (!file_exists($protoFile)) { |
|
| 43 | + if (!file_exists($protoFile)) |
|
| 44 | + { |
|
| 44 | 45 | $this->sprintf('<error>File `%s` not found.</error>', $protoFile); |
| 45 | 46 | return; |
| 46 | 47 | } |
@@ -53,19 +54,24 @@ discard block |
||
| 53 | 54 | |
| 54 | 55 | $this->sprintf("<info>Compiling <fg=cyan>`%s`</fg=cyan>:</info>\n", $protoFile); |
| 55 | 56 | |
| 56 | - try { |
|
| 57 | + try |
|
| 58 | + { |
|
| 57 | 59 | $result = $compiler->compile($protoFile); |
| 58 | - } catch (\Throwable $e) { |
|
| 60 | + } |
|
| 61 | + catch (\Throwable $e) |
|
| 62 | + { |
|
| 59 | 63 | $this->sprintf("<error>Error:</error> <fg=red>%s</fg=red>\n", $e->getMessage()); |
| 60 | 64 | return; |
| 61 | 65 | } |
| 62 | 66 | |
| 63 | - if ($result === []) { |
|
| 67 | + if ($result === []) |
|
| 68 | + { |
|
| 64 | 69 | $this->sprintf("<info>No files were generated.</info>\n", $protoFile); |
| 65 | 70 | return; |
| 66 | 71 | } |
| 67 | 72 | |
| 68 | - foreach ($result as $file) { |
|
| 73 | + foreach ($result as $file) |
|
| 74 | + { |
|
| 69 | 75 | $this->sprintf( |
| 70 | 76 | "<fg=green>•</fg=green> %s%s%s\n", |
| 71 | 77 | Color::LIGHT_WHITE, |
@@ -84,7 +90,8 @@ discard block |
||
| 84 | 90 | protected function getPath(KernelInterface $kernel): string |
| 85 | 91 | { |
| 86 | 92 | $path = $this->argument('namespace'); |
| 87 | - if ($path !== 'auto') { |
|
| 93 | + if ($path !== 'auto') |
|
| 94 | + { |
|
| 88 | 95 | return $path; |
| 89 | 96 | } |
| 90 | 97 | |
@@ -102,7 +109,8 @@ discard block |
||
| 102 | 109 | protected function getNamespace(KernelInterface $kernel): string |
| 103 | 110 | { |
| 104 | 111 | $namespace = $this->argument('namespace'); |
| 105 | - if ($namespace !== 'auto') { |
|
| 112 | + if ($namespace !== 'auto') |
|
| 113 | + { |
|
| 106 | 114 | return $namespace; |
| 107 | 115 | } |
| 108 | 116 | |
@@ -55,21 +55,21 @@ |
||
| 55 | 55 | $this->sprintf("<info>New encryption key:</info> <fg=cyan>%s</fg=cyan>\n", $key); |
| 56 | 56 | |
| 57 | 57 | $file = $this->option('mount'); |
| 58 | - if ($file === null) { |
|
| 58 | + if ($file === null){ |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if (!$files->exists($file)) { |
|
| 62 | + if (!$files->exists($file)){ |
|
| 63 | 63 | $this->sprintf('<error>Unable to find `%s`</error>', $file); |
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $content = $files->read($file); |
| 68 | 68 | |
| 69 | - try { |
|
| 69 | + try{ |
|
| 70 | 70 | $content = str_replace($this->option('placeholder'), $key, $content); |
| 71 | 71 | $content = str_replace($enc->getKey(), $key, $content); |
| 72 | - } catch (\Throwable $e) { |
|
| 72 | + }catch (\Throwable $e){ |
|
| 73 | 73 | // current keys is not set |
| 74 | 74 | } |
| 75 | 75 | |
@@ -55,21 +55,26 @@ |
||
| 55 | 55 | $this->sprintf("<info>New encryption key:</info> <fg=cyan>%s</fg=cyan>\n", $key); |
| 56 | 56 | |
| 57 | 57 | $file = $this->option('mount'); |
| 58 | - if ($file === null) { |
|
| 58 | + if ($file === null) |
|
| 59 | + { |
|
| 59 | 60 | return; |
| 60 | 61 | } |
| 61 | 62 | |
| 62 | - if (!$files->exists($file)) { |
|
| 63 | + if (!$files->exists($file)) |
|
| 64 | + { |
|
| 63 | 65 | $this->sprintf('<error>Unable to find `%s`</error>', $file); |
| 64 | 66 | return; |
| 65 | 67 | } |
| 66 | 68 | |
| 67 | 69 | $content = $files->read($file); |
| 68 | 70 | |
| 69 | - try { |
|
| 71 | + try |
|
| 72 | + { |
|
| 70 | 73 | $content = str_replace($this->option('placeholder'), $key, $content); |
| 71 | 74 | $content = str_replace($enc->getKey(), $key, $content); |
| 72 | - } catch (\Throwable $e) { |
|
| 75 | + } |
|
| 76 | + catch (\Throwable $e) |
|
| 77 | + { |
|
| 73 | 78 | // current keys is not set |
| 74 | 79 | } |
| 75 | 80 | |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | $http = $this->container->get(Http::class); |
| 59 | 59 | $emitter = $emitter ?? $this->container->get(EmitterInterface::class); |
| 60 | 60 | |
| 61 | - try { |
|
| 61 | + try{ |
|
| 62 | 62 | $response = $http->handle($this->initRequest()); |
| 63 | 63 | $emitter->emit($response); |
| 64 | - } catch (\Throwable $e) { |
|
| 64 | + }catch (\Throwable $e){ |
|
| 65 | 65 | $this->handleException($emitter, $e); |
| 66 | - } finally { |
|
| 66 | + }finally{ |
|
| 67 | 67 | $this->finalizer->finalize(false); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $handler = new HtmlHandler(); |
| 86 | 86 | |
| 87 | - try { |
|
| 87 | + try{ |
|
| 88 | 88 | /** @var SnapshotInterface $snapshot */ |
| 89 | 89 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 90 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
| 90 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
| 91 | 91 | // nothing to report |
| 92 | 92 | } |
| 93 | 93 | |
@@ -58,12 +58,17 @@ discard block |
||
| 58 | 58 | $http = $this->container->get(Http::class); |
| 59 | 59 | $emitter = $emitter ?? $this->container->get(EmitterInterface::class); |
| 60 | 60 | |
| 61 | - try { |
|
| 61 | + try |
|
| 62 | + { |
|
| 62 | 63 | $response = $http->handle($this->initRequest()); |
| 63 | 64 | $emitter->emit($response); |
| 64 | - } catch (\Throwable $e) { |
|
| 65 | + } |
|
| 66 | + catch (\Throwable $e) |
|
| 67 | + { |
|
| 65 | 68 | $this->handleException($emitter, $e); |
| 66 | - } finally { |
|
| 69 | + } |
|
| 70 | + finally |
|
| 71 | + { |
|
| 67 | 72 | $this->finalizer->finalize(false); |
| 68 | 73 | } |
| 69 | 74 | } |
@@ -84,10 +89,13 @@ discard block |
||
| 84 | 89 | { |
| 85 | 90 | $handler = new HtmlHandler(); |
| 86 | 91 | |
| 87 | - try { |
|
| 92 | + try |
|
| 93 | + { |
|
| 88 | 94 | /** @var SnapshotInterface $snapshot */ |
| 89 | 95 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 90 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
| 96 | + } |
|
| 97 | + catch (\Throwable | ContainerExceptionInterface $se) |
|
| 98 | + { |
|
| 91 | 99 | // nothing to report |
| 92 | 100 | } |
| 93 | 101 | |
@@ -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; |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | /** @var Http $http */ |
| 73 | 73 | $http = $this->container->get(Http::class); |
| 74 | - while ($request = $client->acceptRequest()) { |
|
| 75 | - try { |
|
| 74 | + while ($request = $client->acceptRequest()){ |
|
| 75 | + try{ |
|
| 76 | 76 | $client->respond($http->handle($request)); |
| 77 | - } catch (\Throwable $e) { |
|
| 77 | + }catch (\Throwable $e){ |
|
| 78 | 78 | $this->handleException($client, $e); |
| 79 | - } finally { |
|
| 79 | + }finally{ |
|
| 80 | 80 | $this->finalizer->finalize(false); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $handler = new HtmlHandler(); |
| 92 | 92 | |
| 93 | - try { |
|
| 93 | + try{ |
|
| 94 | 94 | /** @var SnapshotInterface $snapshot */ |
| 95 | 95 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
| 96 | 96 | error_log($snapshot->getMessage()); |
| 97 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
| 97 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
| 98 | 98 | error_log((string)$e); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -71,12 +71,18 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | /** @var Http $http */ |
| 73 | 73 | $http = $this->container->get(Http::class); |
| 74 | - while ($request = $client->acceptRequest()) { |
|
| 75 | - try { |
|
| 74 | + while ($request = $client->acceptRequest()) |
|
| 75 | + { |
|
| 76 | + try |
|
| 77 | + { |
|
| 76 | 78 | $client->respond($http->handle($request)); |
| 77 | - } catch (\Throwable $e) { |
|
| 79 | + } |
|
| 80 | + catch (\Throwable $e) |
|
| 81 | + { |
|
| 78 | 82 | $this->handleException($client, $e); |
| 79 | - } finally { |
|
| 83 | + } |
|
| 84 | + finally |
|
| 85 | + { |
|
| 80 | 86 | $this->finalizer->finalize(false); |
| 81 | 87 | } |
| 82 | 88 | } |
@@ -90,11 +96,14 @@ discard block |
||
| 90 | 96 | { |
| 91 | 97 | $handler = new HtmlHandler(); |
| 92 | 98 | |
| 93 | - try { |
|
| 99 | + try |
|
| 100 | + { |
|
| 94 | 101 | /** @var SnapshotInterface $snapshot */ |
| 95 | 102 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
| 96 | 103 | error_log($snapshot->getMessage()); |
| 97 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
| 104 | + } |
|
| 105 | + catch (\Throwable | ContainerExceptionInterface $se) |
|
| 106 | + { |
|
| 98 | 107 | error_log((string)$e); |
| 99 | 108 | } |
| 100 | 109 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | $runtimeDirectory = $this->dirs->get('runtime'); |
| 46 | 46 | |
| 47 | - if (!$this->files->exists($runtimeDirectory)) { |
|
| 47 | + if (!$this->files->exists($runtimeDirectory)){ |
|
| 48 | 48 | $this->files->ensureDirectory($runtimeDirectory); |
| 49 | 49 | $output->writeln('<comment>created</comment>'); |
| 50 | 50 | return; |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | $output->writeln('<info>exists</info>'); |
| 53 | 53 | |
| 54 | 54 | |
| 55 | - foreach ($this->files->getFiles($runtimeDirectory) as $filename) { |
|
| 56 | - try { |
|
| 55 | + foreach ($this->files->getFiles($runtimeDirectory) as $filename){ |
|
| 56 | + try{ |
|
| 57 | 57 | $this->files->setPermissions($filename, FilesInterface::RUNTIME); |
| 58 | 58 | $this->files->setPermissions(dirname($filename), FilesInterface::RUNTIME); |
| 59 | - } catch (\Throwable $e) { |
|
| 59 | + }catch (\Throwable $e){ |
|
| 60 | 60 | // @codeCoverageIgnoreStart |
| 61 | 61 | $output->writeln(sprintf( |
| 62 | 62 | '<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>', |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | // @codeCoverageIgnoreEnd |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if ($output->isVerbose()) { |
|
| 70 | + if ($output->isVerbose()){ |
|
| 71 | 71 | $output->writeln(sprintf( |
| 72 | 72 | '<fg=green>[updated]</fg=green> `%s`', |
| 73 | 73 | $this->files->relativePath($filename, $runtimeDirectory) |
@@ -44,7 +44,8 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | $runtimeDirectory = $this->dirs->get('runtime'); |
| 46 | 46 | |
| 47 | - if (!$this->files->exists($runtimeDirectory)) { |
|
| 47 | + if (!$this->files->exists($runtimeDirectory)) |
|
| 48 | + { |
|
| 48 | 49 | $this->files->ensureDirectory($runtimeDirectory); |
| 49 | 50 | $output->writeln('<comment>created</comment>'); |
| 50 | 51 | return; |
@@ -52,11 +53,15 @@ discard block |
||
| 52 | 53 | $output->writeln('<info>exists</info>'); |
| 53 | 54 | |
| 54 | 55 | |
| 55 | - foreach ($this->files->getFiles($runtimeDirectory) as $filename) { |
|
| 56 | - try { |
|
| 56 | + foreach ($this->files->getFiles($runtimeDirectory) as $filename) |
|
| 57 | + { |
|
| 58 | + try |
|
| 59 | + { |
|
| 57 | 60 | $this->files->setPermissions($filename, FilesInterface::RUNTIME); |
| 58 | 61 | $this->files->setPermissions(dirname($filename), FilesInterface::RUNTIME); |
| 59 | - } catch (\Throwable $e) { |
|
| 62 | + } |
|
| 63 | + catch (\Throwable $e) |
|
| 64 | + { |
|
| 60 | 65 | // @codeCoverageIgnoreStart |
| 61 | 66 | $output->writeln(sprintf( |
| 62 | 67 | '<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>', |
@@ -67,7 +72,8 @@ discard block |
||
| 67 | 72 | // @codeCoverageIgnoreEnd |
| 68 | 73 | } |
| 69 | 74 | |
| 70 | - if ($output->isVerbose()) { |
|
| 75 | + if ($output->isVerbose()) |
|
| 76 | + { |
|
| 71 | 77 | $output->writeln(sprintf( |
| 72 | 78 | '<fg=green>[updated]</fg=green> `%s`', |
| 73 | 79 | $this->files->relativePath($filename, $runtimeDirectory) |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | EnvironmentInterface $env, |
| 48 | 48 | FinalizerInterface $finalizer, |
| 49 | 49 | ContainerInterface $container |
| 50 | - ) { |
|
| 50 | + ){ |
|
| 51 | 51 | $this->env = $env; |
| 52 | 52 | $this->finalizer = $finalizer; |
| 53 | 53 | $this->container = $container; |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | /** @var Console $console */ |
| 77 | 77 | $console = $this->container->get(Console::class); |
| 78 | 78 | |
| 79 | - try { |
|
| 79 | + try{ |
|
| 80 | 80 | $console->start($input ?? new ArgvInput(), $output); |
| 81 | - } catch (\Throwable $e) { |
|
| 81 | + }catch (\Throwable $e){ |
|
| 82 | 82 | $this->handleException($e, $output); |
| 83 | - } finally { |
|
| 83 | + }finally{ |
|
| 84 | 84 | $listener->disable(); |
| 85 | 85 | $this->finalizer->finalize(false); |
| 86 | 86 | } |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | protected function handleException(\Throwable $e, OutputInterface $output): void |
| 94 | 94 | { |
| 95 | - try { |
|
| 95 | + try{ |
|
| 96 | 96 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 97 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
| 97 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
| 98 | 98 | // no need to notify when unable to register an exception |
| 99 | 99 | } |
| 100 | 100 | |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | private function mapVerbosity(OutputInterface $output): int |
| 111 | 111 | { |
| 112 | - if ($output->isDebug()) { |
|
| 112 | + if ($output->isDebug()){ |
|
| 113 | 113 | return ConsoleHandler::VERBOSITY_DEBUG; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if ($output->isVeryVerbose()) { |
|
| 116 | + if ($output->isVeryVerbose()){ |
|
| 117 | 117 | return ConsoleHandler::VERBOSITY_VERBOSE; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -76,11 +76,16 @@ discard block |
||
| 76 | 76 | /** @var Console $console */ |
| 77 | 77 | $console = $this->container->get(Console::class); |
| 78 | 78 | |
| 79 | - try { |
|
| 79 | + try |
|
| 80 | + { |
|
| 80 | 81 | $console->start($input ?? new ArgvInput(), $output); |
| 81 | - } catch (\Throwable $e) { |
|
| 82 | + } |
|
| 83 | + catch (\Throwable $e) |
|
| 84 | + { |
|
| 82 | 85 | $this->handleException($e, $output); |
| 83 | - } finally { |
|
| 86 | + } |
|
| 87 | + finally |
|
| 88 | + { |
|
| 84 | 89 | $listener->disable(); |
| 85 | 90 | $this->finalizer->finalize(false); |
| 86 | 91 | } |
@@ -92,9 +97,12 @@ discard block |
||
| 92 | 97 | */ |
| 93 | 98 | protected function handleException(\Throwable $e, OutputInterface $output): void |
| 94 | 99 | { |
| 95 | - try { |
|
| 100 | + try |
|
| 101 | + { |
|
| 96 | 102 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 97 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
| 103 | + } |
|
| 104 | + catch (\Throwable | ContainerExceptionInterface $se) |
|
| 105 | + { |
|
| 98 | 106 | // no need to notify when unable to register an exception |
| 99 | 107 | } |
| 100 | 108 | |
@@ -109,11 +117,13 @@ discard block |
||
| 109 | 117 | */ |
| 110 | 118 | private function mapVerbosity(OutputInterface $output): int |
| 111 | 119 | { |
| 112 | - if ($output->isDebug()) { |
|
| 120 | + if ($output->isDebug()) |
|
| 121 | + { |
|
| 113 | 122 | return ConsoleHandler::VERBOSITY_DEBUG; |
| 114 | 123 | } |
| 115 | 124 | |
| 116 | - if ($output->isVeryVerbose()) { |
|
| 125 | + if ($output->isVeryVerbose()) |
|
| 126 | + { |
|
| 117 | 127 | return ConsoleHandler::VERBOSITY_VERBOSE; |
| 118 | 128 | } |
| 119 | 129 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | EnvironmentInterface $env, |
| 39 | 39 | FinalizerInterface $finalizer, |
| 40 | 40 | ContainerInterface $container |
| 41 | - ) { |
|
| 41 | + ){ |
|
| 42 | 42 | $this->env = $env; |
| 43 | 43 | $this->finalizer = $finalizer; |
| 44 | 44 | $this->container = $container; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $worker = $this->container->get(Worker::class); |
| 66 | 66 | |
| 67 | 67 | $consumer->serve($worker, function (\Throwable $e = null): void { |
| 68 | - if ($e !== null) { |
|
| 68 | + if ($e !== null){ |
|
| 69 | 69 | $this->handleException($e); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | protected function handleException(\Throwable $e): void |
| 80 | 80 | { |
| 81 | - try { |
|
| 81 | + try{ |
|
| 82 | 82 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 83 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
| 83 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
| 84 | 84 | // no need to notify when unable to register an exception |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -65,7 +65,8 @@ discard block |
||
| 65 | 65 | $worker = $this->container->get(Worker::class); |
| 66 | 66 | |
| 67 | 67 | $consumer->serve($worker, function (\Throwable $e = null): void { |
| 68 | - if ($e !== null) { |
|
| 68 | + if ($e !== null) |
|
| 69 | + { |
|
| 69 | 70 | $this->handleException($e); |
| 70 | 71 | } |
| 71 | 72 | |
@@ -78,9 +79,12 @@ discard block |
||
| 78 | 79 | */ |
| 79 | 80 | protected function handleException(\Throwable $e): void |
| 80 | 81 | { |
| 81 | - try { |
|
| 82 | + try |
|
| 83 | + { |
|
| 82 | 84 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 83 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
| 85 | + } |
|
| 86 | + catch (\Throwable | ContainerExceptionInterface $se) |
|
| 87 | + { |
|
| 84 | 88 | // no need to notify when unable to register an exception |
| 85 | 89 | } |
| 86 | 90 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | EnvironmentInterface $env, |
| 39 | 39 | FinalizerInterface $finalizer, |
| 40 | 40 | ContainerInterface $container |
| 41 | - ) { |
|
| 41 | + ){ |
|
| 42 | 42 | $this->env = $env; |
| 43 | 43 | $this->finalizer = $finalizer; |
| 44 | 44 | $this->container = $container; |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | $worker = $this->container->get(Worker::class); |
| 67 | 67 | $locator = $this->container->get(LocatorInterface::class); |
| 68 | 68 | |
| 69 | - foreach ($locator->getServices() as $interface => $service) { |
|
| 69 | + foreach ($locator->getServices() as $interface => $service){ |
|
| 70 | 70 | $server->registerService($interface, $service); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $server->serve($worker, function (\Throwable $e = null): void { |
| 74 | - if ($e !== null) { |
|
| 74 | + if ($e !== null){ |
|
| 75 | 75 | $this->handleException($e); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | protected function handleException(\Throwable $e): void |
| 86 | 86 | { |
| 87 | - try { |
|
| 87 | + try{ |
|
| 88 | 88 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 89 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
| 89 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
| 90 | 90 | // no need to notify when unable to register an exception |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -66,12 +66,14 @@ discard block |
||
| 66 | 66 | $worker = $this->container->get(Worker::class); |
| 67 | 67 | $locator = $this->container->get(LocatorInterface::class); |
| 68 | 68 | |
| 69 | - foreach ($locator->getServices() as $interface => $service) { |
|
| 69 | + foreach ($locator->getServices() as $interface => $service) |
|
| 70 | + { |
|
| 70 | 71 | $server->registerService($interface, $service); |
| 71 | 72 | } |
| 72 | 73 | |
| 73 | 74 | $server->serve($worker, function (\Throwable $e = null): void { |
| 74 | - if ($e !== null) { |
|
| 75 | + if ($e !== null) |
|
| 76 | + { |
|
| 75 | 77 | $this->handleException($e); |
| 76 | 78 | } |
| 77 | 79 | |
@@ -84,9 +86,12 @@ discard block |
||
| 84 | 86 | */ |
| 85 | 87 | protected function handleException(\Throwable $e): void |
| 86 | 88 | { |
| 87 | - try { |
|
| 89 | + try |
|
| 90 | + { |
|
| 88 | 91 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 89 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
| 92 | + } |
|
| 93 | + catch (\Throwable | ContainerExceptionInterface $se) |
|
| 94 | + { |
|
| 90 | 95 | // no need to notify when unable to register an exception |
| 91 | 96 | } |
| 92 | 97 | } |