@@ -38,7 +38,7 @@ |
||
| 38 | 38 | CatalogueManager $manager, |
| 39 | 39 | InvocationsInterface $invocations, |
| 40 | 40 | ClassesInterface $classes |
| 41 | - ) { |
|
| 41 | + ){ |
|
| 42 | 42 | $catalogue = $manager->load( |
| 43 | 43 | $this->argument('locale') ?? $config->getDefaultLocale() |
| 44 | 44 | ); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function perform(TranslatorConfig $config, CatalogueManager $manager) |
| 40 | 40 | { |
| 41 | - if (!$config->hasDumper($this->option('dumper'))) { |
|
| 41 | + if (!$config->hasDumper($this->option('dumper'))){ |
|
| 42 | 42 | $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>"); |
| 43 | 43 | |
| 44 | 44 | return; |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | $catalogue->getData() |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - if ($this->option('fallback')) { |
|
| 55 | - foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) { |
|
| 56 | - foreach ($messages as $id => $message) { |
|
| 57 | - if (!$messageCatalogue->defines($id, $domain)) { |
|
| 54 | + if ($this->option('fallback')){ |
|
| 55 | + foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages){ |
|
| 56 | + foreach ($messages as $id => $message){ |
|
| 57 | + if (!$messageCatalogue->defines($id, $domain)){ |
|
| 58 | 58 | $messageCatalogue->set($id, $message, $domain); |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if ($this->isVerbose() && !empty($messageCatalogue->getDomains())) { |
|
| 64 | + if ($this->isVerbose() && !empty($messageCatalogue->getDomains())){ |
|
| 65 | 65 | $this->sprintf("<info>Exporting domain(s):</info> %s\n", |
| 66 | 66 | join(',', $messageCatalogue->getDomains()) |
| 67 | 67 | ); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | 'xliff_version' => '2.0' // forcing default version for xliff dumper only |
| 76 | 76 | ]); |
| 77 | 77 | |
| 78 | - $this->writeln("Export successfully completed using <info>" . get_class($dumper) . "</info>"); |
|
| 79 | - $this->writeln("Output: <comment>" . realpath($this->argument('path')) . "</comment>"); |
|
| 78 | + $this->writeln("Export successfully completed using <info>".get_class($dumper)."</info>"); |
|
| 79 | + $this->writeln("Output: <comment>".realpath($this->argument('path'))."</comment>"); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | \ No newline at end of file |
@@ -38,7 +38,8 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function perform(TranslatorConfig $config, CatalogueManager $manager) |
| 40 | 40 | { |
| 41 | - if (!$config->hasDumper($this->option('dumper'))) { |
|
| 41 | + if (!$config->hasDumper($this->option('dumper'))) |
|
| 42 | + { |
|
| 42 | 43 | $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>"); |
| 43 | 44 | |
| 44 | 45 | return; |
@@ -51,17 +52,22 @@ discard block |
||
| 51 | 52 | $catalogue->getData() |
| 52 | 53 | ); |
| 53 | 54 | |
| 54 | - if ($this->option('fallback')) { |
|
| 55 | - foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) { |
|
| 56 | - foreach ($messages as $id => $message) { |
|
| 57 | - if (!$messageCatalogue->defines($id, $domain)) { |
|
| 55 | + if ($this->option('fallback')) |
|
| 56 | + { |
|
| 57 | + foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) |
|
| 58 | + { |
|
| 59 | + foreach ($messages as $id => $message) |
|
| 60 | + { |
|
| 61 | + if (!$messageCatalogue->defines($id, $domain)) |
|
| 62 | + { |
|
| 58 | 63 | $messageCatalogue->set($id, $message, $domain); |
| 59 | 64 | } |
| 60 | 65 | } |
| 61 | 66 | } |
| 62 | 67 | } |
| 63 | 68 | |
| 64 | - if ($this->isVerbose() && !empty($messageCatalogue->getDomains())) { |
|
| 69 | + if ($this->isVerbose() && !empty($messageCatalogue->getDomains())) |
|
| 70 | + { |
|
| 65 | 71 | $this->sprintf("<info>Exporting domain(s):</info> %s\n", |
| 66 | 72 | join(',', $messageCatalogue->getDomains()) |
| 67 | 73 | ); |
@@ -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 | |
@@ -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 | [], |
@@ -57,8 +57,10 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $consumer = $this->container->get(Consumer::class); |
| 59 | 59 | |
| 60 | - $consumer->serve(function (\Throwable $e = null) { |
|
| 61 | - if ($e !== null) { |
|
| 60 | + $consumer->serve(function (\Throwable $e = null) |
|
| 61 | + { |
|
| 62 | + if ($e !== null) |
|
| 63 | + { |
|
| 62 | 64 | $this->handleException($e); |
| 63 | 65 | } |
| 64 | 66 | |
@@ -71,9 +73,12 @@ discard block |
||
| 71 | 73 | */ |
| 72 | 74 | protected function handleException(\Throwable $e) |
| 73 | 75 | { |
| 74 | - try { |
|
| 76 | + try |
|
| 77 | + { |
|
| 75 | 78 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 76 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
| 79 | + } |
|
| 80 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
| 81 | + { |
|
| 77 | 82 | // no need to notify when unable to register an exception |
| 78 | 83 | } |
| 79 | 84 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | EnvironmentInterface $env, |
| 37 | 37 | FinalizerInterface $finalizer, |
| 38 | 38 | ContainerInterface $container |
| 39 | - ) { |
|
| 39 | + ){ |
|
| 40 | 40 | $this->env = $env; |
| 41 | 41 | $this->finalizer = $finalizer; |
| 42 | 42 | $this->container = $container; |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $consumer = $this->container->get(Consumer::class); |
| 59 | 59 | |
| 60 | - $consumer->serve(function (\Throwable $e = null) { |
|
| 61 | - if ($e !== null) { |
|
| 60 | + $consumer->serve(function (\Throwable $e = null){ |
|
| 61 | + if ($e !== null){ |
|
| 62 | 62 | $this->handleException($e); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | protected function handleException(\Throwable $e) |
| 73 | 73 | { |
| 74 | - try { |
|
| 74 | + try{ |
|
| 75 | 75 | $this->container->get(SnapshotterInterface::class)->register($e); |
| 76 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
| 76 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
| 77 | 77 | // no need to notify when unable to register an exception |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -37,13 +37,13 @@ |
||
| 37 | 37 | $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]); |
| 38 | 38 | $this->assertContains('default.users', $output); |
| 39 | 39 | |
| 40 | - $user = file_get_contents(__DIR__ . '/../../app/src/User/User.php'); |
|
| 41 | - unlink(__DIR__ . '/../../app/src/User/User.php'); |
|
| 42 | - try { |
|
| 40 | + $user = file_get_contents(__DIR__.'/../../app/src/User/User.php'); |
|
| 41 | + unlink(__DIR__.'/../../app/src/User/User.php'); |
|
| 42 | + try{ |
|
| 43 | 43 | $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]); |
| 44 | 44 | $this->assertContains('drop foreign key', $output); |
| 45 | - } finally { |
|
| 46 | - file_put_contents(__DIR__ . '/../../app/src/User/User.php', $user); |
|
| 45 | + }finally{ |
|
| 46 | + file_put_contents(__DIR__.'/../../app/src/User/User.php', $user); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |
@@ -39,10 +39,13 @@ |
||
| 39 | 39 | |
| 40 | 40 | $user = file_get_contents(__DIR__ . '/../../app/src/User/User.php'); |
| 41 | 41 | unlink(__DIR__ . '/../../app/src/User/User.php'); |
| 42 | - try { |
|
| 42 | + try |
|
| 43 | + { |
|
| 43 | 44 | $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]); |
| 44 | 45 | $this->assertContains('drop foreign key', $output); |
| 45 | - } finally { |
|
| 46 | + } |
|
| 47 | + finally |
|
| 48 | + { |
|
| 46 | 49 | file_put_contents(__DIR__ . '/../../app/src/User/User.php', $user); |
| 47 | 50 | } |
| 48 | 51 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $this->assertNull($this->app->getEnvironment()->get('FIRED')); |
| 39 | 39 | |
| 40 | 40 | $w->shouldReceive('receive')->once()->with( |
| 41 | - \Mockery::on(function (&$context) { |
|
| 41 | + \Mockery::on(function (&$context){ |
|
| 42 | 42 | $context = '{ |
| 43 | 43 | "id": "1", |
| 44 | 44 | "job": "spiral.app.job.TestJob" |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $this->app->getContainer()->bind(Worker::class, $w); |
| 67 | 67 | |
| 68 | 68 | $w->shouldReceive('receive')->once()->with( |
| 69 | - \Mockery::on(function (&$context) { |
|
| 69 | + \Mockery::on(function (&$context){ |
|
| 70 | 70 | $context = '{ |
| 71 | 71 | "id": "1", |
| 72 | 72 | "job": "spiral.app.job.ErrorJob" |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $w->shouldReceive('receive')->once()->andReturn(null); |
| 83 | 83 | |
| 84 | 84 | $files = $this->app->get(FilesInterface::class)->getFiles( |
| 85 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
| 85 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
| 86 | 86 | ); |
| 87 | 87 | |
| 88 | 88 | $this->assertCount(0, $files); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $this->app->get(JobDispatcher::class)->serve(); |
| 91 | 91 | |
| 92 | 92 | $files = $this->app->get(FilesInterface::class)->getFiles( |
| 93 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
| 93 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
| 94 | 94 | ); |
| 95 | 95 | |
| 96 | 96 | $this->assertCount(1, $files); |
@@ -38,7 +38,8 @@ discard block |
||
| 38 | 38 | $this->assertNull($this->app->getEnvironment()->get('FIRED')); |
| 39 | 39 | |
| 40 | 40 | $w->shouldReceive('receive')->once()->with( |
| 41 | - \Mockery::on(function (&$context) { |
|
| 41 | + \Mockery::on(function (&$context) |
|
| 42 | + { |
|
| 42 | 43 | $context = '{ |
| 43 | 44 | "id": "1", |
| 44 | 45 | "job": "spiral.app.job.TestJob" |
@@ -66,7 +67,8 @@ discard block |
||
| 66 | 67 | $this->app->getContainer()->bind(Worker::class, $w); |
| 67 | 68 | |
| 68 | 69 | $w->shouldReceive('receive')->once()->with( |
| 69 | - \Mockery::on(function (&$context) { |
|
| 70 | + \Mockery::on(function (&$context) |
|
| 71 | + { |
|
| 70 | 72 | $context = '{ |
| 71 | 73 | "id": "1", |
| 72 | 74 | "job": "spiral.app.job.ErrorJob" |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | PermissionsInterface $rbac, |
| 30 | 30 | ViewsBootloader $views, |
| 31 | 31 | ValidationBootloader $validation |
| 32 | - ) { |
|
| 32 | + ){ |
|
| 33 | 33 | $rbac->addRole('user'); |
| 34 | 34 | $rbac->associate('user', '*'); |
| 35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $router->setDefault($route->withDefaults(['name' => 'Dave'])); |
| 42 | 42 | |
| 43 | - $views->addDirectory('custom', __DIR__ . '/../../views/custom/'); |
|
| 43 | + $views->addDirectory('custom', __DIR__.'/../../views/custom/'); |
|
| 44 | 44 | $views->addEngine(TestEngine::class); |
| 45 | 45 | |
| 46 | 46 | $validation->addAlias('aliased', 'notEmpty'); |