@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | public function perform(KernelInterface $kernel, FilesInterface $files, DirectoriesInterface $dirs) |
40 | 40 | { |
41 | 41 | $protoFile = $this->argument('proto'); |
42 | - if (!file_exists($protoFile)) { |
|
42 | + if (!file_exists($protoFile)){ |
|
43 | 43 | $this->sprintf("<error>File `%s` not found.</error>", $protoFile); |
44 | 44 | return; |
45 | 45 | } |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | |
53 | 53 | $this->sprintf("<info>Compiling <fg=cyan>`%s`</fg=cyan>:</info>\n", $protoFile); |
54 | 54 | |
55 | - try { |
|
55 | + try{ |
|
56 | 56 | $result = $compiler->compile($protoFile); |
57 | - } catch (\Throwable $e) { |
|
57 | + }catch (\Throwable $e){ |
|
58 | 58 | $this->sprintf("<error>Error:</error> <fg=red>%s</fg=red>\n", $e->getMessage()); |
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if ($result === []) { |
|
62 | + if ($result === []){ |
|
63 | 63 | $this->sprintf("<info>No files were generated.</info>\n", $protoFile); |
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | - foreach ($result as $file) { |
|
67 | + foreach ($result as $file){ |
|
68 | 68 | $this->sprintf( |
69 | 69 | "<fg=green>•</fg=green> %s%s%s\n", |
70 | 70 | Color::LIGHT_WHITE, |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | protected function getPath(KernelInterface $kernel): string |
84 | 84 | { |
85 | 85 | $path = $this->argument('namespace'); |
86 | - if ($path !== 'auto') { |
|
86 | + if ($path !== 'auto'){ |
|
87 | 87 | return $path; |
88 | 88 | } |
89 | 89 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | protected function getNamespace(KernelInterface $kernel): string |
102 | 102 | { |
103 | 103 | $namespace = $this->argument('namespace'); |
104 | - if ($namespace !== 'auto') { |
|
104 | + if ($namespace !== 'auto'){ |
|
105 | 105 | return $namespace; |
106 | 106 | } |
107 | 107 |
@@ -39,7 +39,8 @@ discard block |
||
39 | 39 | public function perform(KernelInterface $kernel, FilesInterface $files, DirectoriesInterface $dirs) |
40 | 40 | { |
41 | 41 | $protoFile = $this->argument('proto'); |
42 | - if (!file_exists($protoFile)) { |
|
42 | + if (!file_exists($protoFile)) |
|
43 | + { |
|
43 | 44 | $this->sprintf("<error>File `%s` not found.</error>", $protoFile); |
44 | 45 | return; |
45 | 46 | } |
@@ -52,19 +53,24 @@ discard block |
||
52 | 53 | |
53 | 54 | $this->sprintf("<info>Compiling <fg=cyan>`%s`</fg=cyan>:</info>\n", $protoFile); |
54 | 55 | |
55 | - try { |
|
56 | + try |
|
57 | + { |
|
56 | 58 | $result = $compiler->compile($protoFile); |
57 | - } catch (\Throwable $e) { |
|
59 | + } |
|
60 | + catch (\Throwable $e) |
|
61 | + { |
|
58 | 62 | $this->sprintf("<error>Error:</error> <fg=red>%s</fg=red>\n", $e->getMessage()); |
59 | 63 | return; |
60 | 64 | } |
61 | 65 | |
62 | - if ($result === []) { |
|
66 | + if ($result === []) |
|
67 | + { |
|
63 | 68 | $this->sprintf("<info>No files were generated.</info>\n", $protoFile); |
64 | 69 | return; |
65 | 70 | } |
66 | 71 | |
67 | - foreach ($result as $file) { |
|
72 | + foreach ($result as $file) |
|
73 | + { |
|
68 | 74 | $this->sprintf( |
69 | 75 | "<fg=green>•</fg=green> %s%s%s\n", |
70 | 76 | Color::LIGHT_WHITE, |
@@ -83,7 +89,8 @@ discard block |
||
83 | 89 | protected function getPath(KernelInterface $kernel): string |
84 | 90 | { |
85 | 91 | $path = $this->argument('namespace'); |
86 | - if ($path !== 'auto') { |
|
92 | + if ($path !== 'auto') |
|
93 | + { |
|
87 | 94 | return $path; |
88 | 95 | } |
89 | 96 | |
@@ -101,7 +108,8 @@ discard block |
||
101 | 108 | protected function getNamespace(KernelInterface $kernel): string |
102 | 109 | { |
103 | 110 | $namespace = $this->argument('namespace'); |
104 | - if ($namespace !== 'auto') { |
|
111 | + if ($namespace !== 'auto') |
|
112 | + { |
|
105 | 113 | return $namespace; |
106 | 114 | } |
107 | 115 |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | GenerateMigrations $migrations, |
49 | 49 | Migrator $migrator, |
50 | 50 | Console $console |
51 | - ) { |
|
52 | - if (!$this->verifyConfigured()) { |
|
51 | + ){ |
|
52 | + if (!$this->verifyConfigured()){ |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
56 | - foreach ($migrator->getMigrations() as $migration) { |
|
57 | - if ($migration->getState()->getStatus() !== State::STATUS_EXECUTED) { |
|
56 | + foreach ($migrator->getMigrations() as $migration){ |
|
57 | + if ($migration->getState()->getStatus() !== State::STATUS_EXECUTED){ |
|
58 | 58 | $this->writeln("<fg=red>Outstanding migrations found, run `migrate` first.</fg=red>"); |
59 | 59 | return; |
60 | 60 | } |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | |
70 | 70 | $memory->saveData('cycle', $schema); |
71 | 71 | |
72 | - if ($show->hasChanges()) { |
|
72 | + if ($show->hasChanges()){ |
|
73 | 73 | (new Compiler())->compile($registry, [$migrations]); |
74 | 74 | |
75 | - if ($this->option('run')) { |
|
75 | + if ($this->option('run')){ |
|
76 | 76 | $console->run('migrate', [], $this->output); |
77 | 77 | } |
78 | 78 | } |
@@ -49,12 +49,15 @@ discard block |
||
49 | 49 | Migrator $migrator, |
50 | 50 | Console $console |
51 | 51 | ) { |
52 | - if (!$this->verifyConfigured()) { |
|
52 | + if (!$this->verifyConfigured()) |
|
53 | + { |
|
53 | 54 | return; |
54 | 55 | } |
55 | 56 | |
56 | - foreach ($migrator->getMigrations() as $migration) { |
|
57 | - if ($migration->getState()->getStatus() !== State::STATUS_EXECUTED) { |
|
57 | + foreach ($migrator->getMigrations() as $migration) |
|
58 | + { |
|
59 | + if ($migration->getState()->getStatus() !== State::STATUS_EXECUTED) |
|
60 | + { |
|
58 | 61 | $this->writeln("<fg=red>Outstanding migrations found, run `migrate` first.</fg=red>"); |
59 | 62 | return; |
60 | 63 | } |
@@ -69,10 +72,12 @@ discard block |
||
69 | 72 | |
70 | 73 | $memory->saveData('cycle', $schema); |
71 | 74 | |
72 | - if ($show->hasChanges()) { |
|
75 | + if ($show->hasChanges()) |
|
76 | + { |
|
73 | 77 | (new Compiler())->compile($registry, [$migrations]); |
74 | 78 | |
75 | - if ($this->option('run')) { |
|
79 | + if ($this->option('run')) |
|
80 | + { |
|
76 | 81 | $console->run('migrate', [], $this->output); |
77 | 82 | } |
78 | 83 | } |
@@ -27,20 +27,20 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function perform(ViewsConfig $config, FilesInterface $files) |
29 | 29 | { |
30 | - if (!$files->exists($config->cacheDirectory())) { |
|
30 | + if (!$files->exists($config->cacheDirectory())){ |
|
31 | 31 | $this->writeln("Cache directory is missing, no cache to be cleaned."); |
32 | 32 | |
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | - if ($this->isVerbose()) { |
|
36 | + if ($this->isVerbose()){ |
|
37 | 37 | $this->writeln("<info>Cleaning view cache:</info>"); |
38 | 38 | } |
39 | 39 | |
40 | - foreach ($files->getFiles($config->cacheDirectory()) as $filename) { |
|
41 | - try { |
|
40 | + foreach ($files->getFiles($config->cacheDirectory()) as $filename){ |
|
41 | + try{ |
|
42 | 42 | $files->delete($filename); |
43 | - } catch (\Throwable $e) { |
|
43 | + }catch (\Throwable $e){ |
|
44 | 44 | // @codeCoverageIgnoreStart |
45 | 45 | $this->sprintf("<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
46 | 46 | $files->relativePath($filename, $config->cacheDirectory()), |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | // @codeCoverageIgnoreEnd |
53 | 53 | } |
54 | 54 | |
55 | - if ($this->isVerbose()) { |
|
55 | + if ($this->isVerbose()){ |
|
56 | 56 | $this->sprintf( |
57 | 57 | "<fg=green>[deleted]</fg=green> `%s`\n", |
58 | 58 | $files->relativePath($filename, $config->cacheDirectory()) |
@@ -27,20 +27,26 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function perform(ViewsConfig $config, FilesInterface $files) |
29 | 29 | { |
30 | - if (!$files->exists($config->cacheDirectory())) { |
|
30 | + if (!$files->exists($config->cacheDirectory())) |
|
31 | + { |
|
31 | 32 | $this->writeln("Cache directory is missing, no cache to be cleaned."); |
32 | 33 | |
33 | 34 | return; |
34 | 35 | } |
35 | 36 | |
36 | - if ($this->isVerbose()) { |
|
37 | + if ($this->isVerbose()) |
|
38 | + { |
|
37 | 39 | $this->writeln("<info>Cleaning view cache:</info>"); |
38 | 40 | } |
39 | 41 | |
40 | - foreach ($files->getFiles($config->cacheDirectory()) as $filename) { |
|
41 | - try { |
|
42 | + foreach ($files->getFiles($config->cacheDirectory()) as $filename) |
|
43 | + { |
|
44 | + try |
|
45 | + { |
|
42 | 46 | $files->delete($filename); |
43 | - } catch (\Throwable $e) { |
|
47 | + } |
|
48 | + catch (\Throwable $e) |
|
49 | + { |
|
44 | 50 | // @codeCoverageIgnoreStart |
45 | 51 | $this->sprintf("<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
46 | 52 | $files->relativePath($filename, $config->cacheDirectory()), |
@@ -52,7 +58,8 @@ discard block |
||
52 | 58 | // @codeCoverageIgnoreEnd |
53 | 59 | } |
54 | 60 | |
55 | - if ($this->isVerbose()) { |
|
61 | + if ($this->isVerbose()) |
|
62 | + { |
|
56 | 63 | $this->sprintf( |
57 | 64 | "<fg=green>[deleted]</fg=green> `%s`\n", |
58 | 65 | $files->relativePath($filename, $config->cacheDirectory()) |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | $generator = new ContextGenerator($views->getContext()); |
33 | 33 | |
34 | 34 | $contexts = $generator->generate(); |
35 | - if (empty($contexts)) { |
|
35 | + if (empty($contexts)){ |
|
36 | 36 | $contexts[] = $views->getContext(); |
37 | 37 | } |
38 | 38 | |
39 | - foreach ($contexts as $context) { |
|
40 | - foreach ($views->getEngines() as $engine) { |
|
39 | + foreach ($contexts as $context){ |
|
40 | + foreach ($views->getEngines() as $engine){ |
|
41 | 41 | $this->compile($engine, $context); |
42 | 42 | } |
43 | 43 | } |
@@ -57,19 +57,19 @@ discard block |
||
57 | 57 | $this->describeContext($context) ?? "default" |
58 | 58 | ); |
59 | 59 | |
60 | - foreach ($engine->getLoader()->list() as $path) { |
|
60 | + foreach ($engine->getLoader()->list() as $path){ |
|
61 | 61 | $start = microtime(true); |
62 | - try { |
|
62 | + try{ |
|
63 | 63 | $engine->reset($path, $context); |
64 | 64 | $engine->compile($path, $context); |
65 | 65 | |
66 | - if ($this->isVerbose()) { |
|
66 | + if ($this->isVerbose()){ |
|
67 | 67 | $this->sprintf("<info>•</info> %s", $path); |
68 | 68 | } |
69 | - } catch (\Throwable $e) { |
|
69 | + }catch (\Throwable $e){ |
|
70 | 70 | $this->renderError($path, $e); |
71 | 71 | continue; |
72 | - } finally { |
|
72 | + }finally{ |
|
73 | 73 | $this->renderElapsed($start); |
74 | 74 | } |
75 | 75 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | $values = []; |
87 | 87 | |
88 | - foreach ($context->getDependencies() as $dependency) { |
|
88 | + foreach ($context->getDependencies() as $dependency){ |
|
89 | 89 | $values[] = sprintf( |
90 | 90 | "%s%s%s:%s%s%s", |
91 | 91 | Color::LIGHT_WHITE, |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function renderError(string $path, \Throwable $e): void |
119 | 119 | { |
120 | - if (!$this->isVerbose()) { |
|
120 | + if (!$this->isVerbose()){ |
|
121 | 121 | return; |
122 | 122 | } |
123 | 123 | |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | */ |
135 | 135 | private function renderSuccess(string $lastPath = null): void |
136 | 136 | { |
137 | - if (!$this->isVerbose()) { |
|
137 | + if (!$this->isVerbose()){ |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - if ($lastPath === null) { |
|
141 | + if ($lastPath === null){ |
|
142 | 142 | $this->writeln("• no views found"); |
143 | 143 | } |
144 | 144 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | private function renderElapsed(float $start): void |
152 | 152 | { |
153 | - if (!$this->isVerbose()) { |
|
153 | + if (!$this->isVerbose()){ |
|
154 | 154 | return; |
155 | 155 | } |
156 | 156 |
@@ -32,12 +32,15 @@ discard block |
||
32 | 32 | $generator = new ContextGenerator($views->getContext()); |
33 | 33 | |
34 | 34 | $contexts = $generator->generate(); |
35 | - if (empty($contexts)) { |
|
35 | + if (empty($contexts)) |
|
36 | + { |
|
36 | 37 | $contexts[] = $views->getContext(); |
37 | 38 | } |
38 | 39 | |
39 | - foreach ($contexts as $context) { |
|
40 | - foreach ($views->getEngines() as $engine) { |
|
40 | + foreach ($contexts as $context) |
|
41 | + { |
|
42 | + foreach ($views->getEngines() as $engine) |
|
43 | + { |
|
41 | 44 | $this->compile($engine, $context); |
42 | 45 | } |
43 | 46 | } |
@@ -57,19 +60,26 @@ discard block |
||
57 | 60 | $this->describeContext($context) ?? "default" |
58 | 61 | ); |
59 | 62 | |
60 | - foreach ($engine->getLoader()->list() as $path) { |
|
63 | + foreach ($engine->getLoader()->list() as $path) |
|
64 | + { |
|
61 | 65 | $start = microtime(true); |
62 | - try { |
|
66 | + try |
|
67 | + { |
|
63 | 68 | $engine->reset($path, $context); |
64 | 69 | $engine->compile($path, $context); |
65 | 70 | |
66 | - if ($this->isVerbose()) { |
|
71 | + if ($this->isVerbose()) |
|
72 | + { |
|
67 | 73 | $this->sprintf("<info>•</info> %s", $path); |
68 | 74 | } |
69 | - } catch (\Throwable $e) { |
|
75 | + } |
|
76 | + catch (\Throwable $e) |
|
77 | + { |
|
70 | 78 | $this->renderError($path, $e); |
71 | 79 | continue; |
72 | - } finally { |
|
80 | + } |
|
81 | + finally |
|
82 | + { |
|
73 | 83 | $this->renderElapsed($start); |
74 | 84 | } |
75 | 85 | } |
@@ -85,7 +95,8 @@ discard block |
||
85 | 95 | { |
86 | 96 | $values = []; |
87 | 97 | |
88 | - foreach ($context->getDependencies() as $dependency) { |
|
98 | + foreach ($context->getDependencies() as $dependency) |
|
99 | + { |
|
89 | 100 | $values[] = sprintf( |
90 | 101 | "%s%s%s:%s%s%s", |
91 | 102 | Color::LIGHT_WHITE, |
@@ -117,7 +128,8 @@ discard block |
||
117 | 128 | */ |
118 | 129 | protected function renderError(string $path, \Throwable $e): void |
119 | 130 | { |
120 | - if (!$this->isVerbose()) { |
|
131 | + if (!$this->isVerbose()) |
|
132 | + { |
|
121 | 133 | return; |
122 | 134 | } |
123 | 135 | |
@@ -134,11 +146,13 @@ discard block |
||
134 | 146 | */ |
135 | 147 | private function renderSuccess(string $lastPath = null): void |
136 | 148 | { |
137 | - if (!$this->isVerbose()) { |
|
149 | + if (!$this->isVerbose()) |
|
150 | + { |
|
138 | 151 | return; |
139 | 152 | } |
140 | 153 | |
141 | - if ($lastPath === null) { |
|
154 | + if ($lastPath === null) |
|
155 | + { |
|
142 | 156 | $this->writeln("• no views found"); |
143 | 157 | } |
144 | 158 | |
@@ -150,7 +164,8 @@ discard block |
||
150 | 164 | */ |
151 | 165 | private function renderElapsed(float $start): void |
152 | 166 | { |
153 | - if (!$this->isVerbose()) { |
|
167 | + if (!$this->isVerbose()) |
|
168 | + { |
|
154 | 169 | return; |
155 | 170 | } |
156 | 171 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $e = new BufferEmitter(); |
40 | 40 | |
41 | 41 | $files = $this->app->get(FilesInterface::class)->getFiles( |
42 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
42 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
43 | 43 | ); |
44 | 44 | |
45 | 45 | $this->assertCount(0, $files); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $this->app->get(SapiDispatcher::class)->serve($e); |
49 | 49 | |
50 | 50 | $files = $this->app->get(FilesInterface::class)->getFiles( |
51 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
51 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
52 | 52 | ); |
53 | 53 | |
54 | 54 | $this->assertCount(1, $files); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ]); |
66 | 66 | |
67 | 67 | $files = $app->get(FilesInterface::class)->getFiles( |
68 | - $app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
68 | + $app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
69 | 69 | ); |
70 | 70 | |
71 | 71 | $this->assertCount(0, $files); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $app->get(SapiDispatcher::class)->serve($e); |
75 | 75 | |
76 | 76 | $files = $app->get(FilesInterface::class)->getFiles( |
77 | - $app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
77 | + $app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
78 | 78 | ); |
79 | 79 | |
80 | 80 | $this->assertCount(1, $files); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function setUp() |
22 | 22 | { |
23 | 23 | parent::setUp(); |
24 | - ini_set('error_log', __DIR__ . '/err.log'); |
|
24 | + ini_set('error_log', __DIR__.'/err.log'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function tearDown() |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | parent::tearDown(); |
30 | 30 | ini_set('error_log', 'stderr'); |
31 | 31 | |
32 | - if (file_exists(__DIR__ . '/err.log')) { |
|
33 | - unlink(__DIR__ . '/err.log'); |
|
32 | + if (file_exists(__DIR__.'/err.log')){ |
|
33 | + unlink(__DIR__.'/err.log'); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ); |
57 | 57 | |
58 | 58 | $psr->shouldReceive('respond')->once()->with( |
59 | - \Mockery::on(function ($r) { |
|
59 | + \Mockery::on(function ($r){ |
|
60 | 60 | $this->assertSame('Hello, dave.', (string)$r->getBody()); |
61 | 61 | return true; |
62 | 62 | }) |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | ); |
79 | 79 | |
80 | 80 | $psr->shouldReceive('respond')->once()->with( |
81 | - \Mockery::on(function ($r) { |
|
81 | + \Mockery::on(function ($r){ |
|
82 | 82 | $this->assertContains('500', (string)$r->getBody()); |
83 | 83 | return true; |
84 | 84 | }) |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $psr->shouldReceive('acceptRequest')->once()->andReturn(null); |
88 | 88 | |
89 | 89 | $files = $this->app->get(FilesInterface::class)->getFiles( |
90 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
90 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
91 | 91 | ); |
92 | 92 | |
93 | 93 | $this->assertCount(0, $files); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $this->app->get(RrDispacher::class)->serve($psr); |
96 | 96 | |
97 | 97 | $files = $this->app->get(FilesInterface::class)->getFiles( |
98 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
98 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
99 | 99 | ); |
100 | 100 | |
101 | 101 | $this->assertCount(1, $files); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | ); |
117 | 117 | |
118 | 118 | $psr->shouldReceive('respond')->once()->with( |
119 | - \Mockery::on(function ($r) { |
|
119 | + \Mockery::on(function ($r){ |
|
120 | 120 | $this->assertContains('undefined', (string)$r->getBody()); |
121 | 121 | return true; |
122 | 122 | }) |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $psr->shouldReceive('acceptRequest')->once()->andReturn(null); |
126 | 126 | |
127 | 127 | $files = $this->app->get(FilesInterface::class)->getFiles( |
128 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
128 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
129 | 129 | ); |
130 | 130 | |
131 | 131 | $this->assertCount(0, $files); |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | $this->app->get(RrDispacher::class)->serve($psr); |
134 | 134 | |
135 | 135 | $files = $this->app->get(FilesInterface::class)->getFiles( |
136 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
136 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
137 | 137 | ); |
138 | 138 | |
139 | 139 | $this->assertCount(1, $files); |
140 | 140 | |
141 | - $this->assertContains('undefined', file_get_contents(__DIR__ . '/err.log')); |
|
141 | + $this->assertContains('undefined', file_get_contents(__DIR__.'/err.log')); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | \ No newline at end of file |
@@ -29,7 +29,8 @@ discard block |
||
29 | 29 | parent::tearDown(); |
30 | 30 | ini_set('error_log', 'stderr'); |
31 | 31 | |
32 | - if (file_exists(__DIR__ . '/err.log')) { |
|
32 | + if (file_exists(__DIR__ . '/err.log')) |
|
33 | + { |
|
33 | 34 | unlink(__DIR__ . '/err.log'); |
34 | 35 | } |
35 | 36 | } |
@@ -56,7 +57,8 @@ discard block |
||
56 | 57 | ); |
57 | 58 | |
58 | 59 | $psr->shouldReceive('respond')->once()->with( |
59 | - \Mockery::on(function ($r) { |
|
60 | + \Mockery::on(function ($r) |
|
61 | + { |
|
60 | 62 | $this->assertSame('Hello, dave.', (string)$r->getBody()); |
61 | 63 | return true; |
62 | 64 | }) |
@@ -78,7 +80,8 @@ discard block |
||
78 | 80 | ); |
79 | 81 | |
80 | 82 | $psr->shouldReceive('respond')->once()->with( |
81 | - \Mockery::on(function ($r) { |
|
83 | + \Mockery::on(function ($r) |
|
84 | + { |
|
82 | 85 | $this->assertContains('500', (string)$r->getBody()); |
83 | 86 | return true; |
84 | 87 | }) |
@@ -116,7 +119,8 @@ discard block |
||
116 | 119 | ); |
117 | 120 | |
118 | 121 | $psr->shouldReceive('respond')->once()->with( |
119 | - \Mockery::on(function ($r) { |
|
122 | + \Mockery::on(function ($r) |
|
123 | + { |
|
120 | 124 | $this->assertContains('undefined', (string)$r->getBody()); |
121 | 125 | return true; |
122 | 126 | }) |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function perform(TranslatorConfig $config, CatalogueManager $manager) |
41 | 41 | { |
42 | - if (!$config->hasDumper($this->option('dumper'))) { |
|
42 | + if (!$config->hasDumper($this->option('dumper'))){ |
|
43 | 43 | $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>"); |
44 | 44 | |
45 | 45 | return; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $manager->get($this->argument('locale')) |
52 | 52 | ); |
53 | 53 | |
54 | - if ($this->isVerbose() && !empty($mc->getDomains())) { |
|
54 | + if ($this->isVerbose() && !empty($mc->getDomains())){ |
|
55 | 55 | $this->sprintf("<info>Exporting domain(s):</info> %s\n", |
56 | 56 | join(',', $mc->getDomains()) |
57 | 57 | ); |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | 'xliff_version' => '2.0' // forcing default version for xliff dumper only |
66 | 66 | ]); |
67 | 67 | |
68 | - $this->writeln("Export successfully completed using <info>" . get_class($dumper) . "</info>"); |
|
69 | - $this->writeln("Output: <comment>" . realpath($this->argument('path')) . "</comment>"); |
|
68 | + $this->writeln("Export successfully completed using <info>".get_class($dumper)."</info>"); |
|
69 | + $this->writeln("Output: <comment>".realpath($this->argument('path'))."</comment>"); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | $catalogue->getData() |
86 | 86 | ); |
87 | 87 | |
88 | - if ($this->option('fallback')) { |
|
89 | - foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) { |
|
90 | - foreach ($messages as $id => $message) { |
|
91 | - if (!$messageCatalogue->defines($id, $domain)) { |
|
88 | + if ($this->option('fallback')){ |
|
89 | + foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages){ |
|
90 | + foreach ($messages as $id => $message){ |
|
91 | + if (!$messageCatalogue->defines($id, $domain)){ |
|
92 | 92 | $messageCatalogue->set($id, $message, $domain); |
93 | 93 | } |
94 | 94 | } |
@@ -39,7 +39,8 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function perform(TranslatorConfig $config, CatalogueManager $manager) |
41 | 41 | { |
42 | - if (!$config->hasDumper($this->option('dumper'))) { |
|
42 | + if (!$config->hasDumper($this->option('dumper'))) |
|
43 | + { |
|
43 | 44 | $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>"); |
44 | 45 | |
45 | 46 | return; |
@@ -51,7 +52,8 @@ discard block |
||
51 | 52 | $manager->get($this->argument('locale')) |
52 | 53 | ); |
53 | 54 | |
54 | - if ($this->isVerbose() && !empty($mc->getDomains())) { |
|
55 | + if ($this->isVerbose() && !empty($mc->getDomains())) |
|
56 | + { |
|
55 | 57 | $this->sprintf("<info>Exporting domain(s):</info> %s\n", |
56 | 58 | join(',', $mc->getDomains()) |
57 | 59 | ); |
@@ -85,10 +87,14 @@ discard block |
||
85 | 87 | $catalogue->getData() |
86 | 88 | ); |
87 | 89 | |
88 | - if ($this->option('fallback')) { |
|
89 | - foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) { |
|
90 | - foreach ($messages as $id => $message) { |
|
91 | - if (!$messageCatalogue->defines($id, $domain)) { |
|
90 | + if ($this->option('fallback')) |
|
91 | + { |
|
92 | + foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) |
|
93 | + { |
|
94 | + foreach ($messages as $id => $message) |
|
95 | + { |
|
96 | + if (!$messageCatalogue->defines($id, $domain)) |
|
97 | + { |
|
92 | 98 | $messageCatalogue->set($id, $message, $domain); |
93 | 99 | } |
94 | 100 | } |
@@ -70,31 +70,31 @@ discard block |
||
70 | 70 | */ |
71 | 71 | private function configureExtensions(ConsoleBootloader $console, Container $container): void |
72 | 72 | { |
73 | - if ($container->has(DatabaseProviderInterface::class)) { |
|
73 | + if ($container->has(DatabaseProviderInterface::class)){ |
|
74 | 74 | $this->configureDatabase($console); |
75 | 75 | } |
76 | 76 | |
77 | - if ($container->has(ORMInterface::class)) { |
|
77 | + if ($container->has(ORMInterface::class)){ |
|
78 | 78 | $this->configureCycle($console, $container); |
79 | 79 | } |
80 | 80 | |
81 | - if ($container->has(TranslatorInterface::class)) { |
|
81 | + if ($container->has(TranslatorInterface::class)){ |
|
82 | 82 | $this->configureTranslator($console); |
83 | 83 | } |
84 | 84 | |
85 | - if ($container->has(ViewsInterface::class)) { |
|
85 | + if ($container->has(ViewsInterface::class)){ |
|
86 | 86 | $this->configureViews($console); |
87 | 87 | } |
88 | 88 | |
89 | - if ($container->has(Migrator::class)) { |
|
89 | + if ($container->has(Migrator::class)){ |
|
90 | 90 | $this->configureMigrations($console); |
91 | 91 | } |
92 | 92 | |
93 | - if ($container->has(InvokerInterface::class)) { |
|
93 | + if ($container->has(InvokerInterface::class)){ |
|
94 | 94 | $this->configureGRPC($console); |
95 | 95 | } |
96 | 96 | |
97 | - if ($container->has(EncryptionInterface::class)) { |
|
97 | + if ($container->has(EncryptionInterface::class)){ |
|
98 | 98 | $this->configureEncrypter($console); |
99 | 99 | } |
100 | 100 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | $console->addCommand(Cycle\SyncCommand::class); |
125 | 125 | |
126 | - if ($container->has(Migrator::class)) { |
|
126 | + if ($container->has(Migrator::class)){ |
|
127 | 127 | $console->addCommand(Cycle\MigrateCommand::class); |
128 | 128 | } |
129 | 129 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $console->addCommand(Translator\ResetCommand::class); |
139 | 139 | |
140 | 140 | $console->addConfigureSequence( |
141 | - function (FilesInterface $files, TranslatorConfig $config, OutputInterface $output) { |
|
141 | + function (FilesInterface $files, TranslatorConfig $config, OutputInterface $output){ |
|
142 | 142 | $files->ensureDirectory($config->getLocaleDirectory($config->getDefaultLocale())); |
143 | 143 | $output->writeln("<info>The default locale directory has been ensured.</info>"); |
144 | 144 | }, |
@@ -70,31 +70,38 @@ discard block |
||
70 | 70 | */ |
71 | 71 | private function configureExtensions(ConsoleBootloader $console, Container $container): void |
72 | 72 | { |
73 | - if ($container->has(DatabaseProviderInterface::class)) { |
|
73 | + if ($container->has(DatabaseProviderInterface::class)) |
|
74 | + { |
|
74 | 75 | $this->configureDatabase($console); |
75 | 76 | } |
76 | 77 | |
77 | - if ($container->has(ORMInterface::class)) { |
|
78 | + if ($container->has(ORMInterface::class)) |
|
79 | + { |
|
78 | 80 | $this->configureCycle($console, $container); |
79 | 81 | } |
80 | 82 | |
81 | - if ($container->has(TranslatorInterface::class)) { |
|
83 | + if ($container->has(TranslatorInterface::class)) |
|
84 | + { |
|
82 | 85 | $this->configureTranslator($console); |
83 | 86 | } |
84 | 87 | |
85 | - if ($container->has(ViewsInterface::class)) { |
|
88 | + if ($container->has(ViewsInterface::class)) |
|
89 | + { |
|
86 | 90 | $this->configureViews($console); |
87 | 91 | } |
88 | 92 | |
89 | - if ($container->has(Migrator::class)) { |
|
93 | + if ($container->has(Migrator::class)) |
|
94 | + { |
|
90 | 95 | $this->configureMigrations($console); |
91 | 96 | } |
92 | 97 | |
93 | - if ($container->has(InvokerInterface::class)) { |
|
98 | + if ($container->has(InvokerInterface::class)) |
|
99 | + { |
|
94 | 100 | $this->configureGRPC($console); |
95 | 101 | } |
96 | 102 | |
97 | - if ($container->has(EncryptionInterface::class)) { |
|
103 | + if ($container->has(EncryptionInterface::class)) |
|
104 | + { |
|
98 | 105 | $this->configureEncrypter($console); |
99 | 106 | } |
100 | 107 | } |
@@ -123,7 +130,8 @@ discard block |
||
123 | 130 | |
124 | 131 | $console->addCommand(Cycle\SyncCommand::class); |
125 | 132 | |
126 | - if ($container->has(Migrator::class)) { |
|
133 | + if ($container->has(Migrator::class)) |
|
134 | + { |
|
127 | 135 | $console->addCommand(Cycle\MigrateCommand::class); |
128 | 136 | } |
129 | 137 | } |
@@ -138,7 +146,8 @@ discard block |
||
138 | 146 | $console->addCommand(Translator\ResetCommand::class); |
139 | 147 | |
140 | 148 | $console->addConfigureSequence( |
141 | - function (FilesInterface $files, TranslatorConfig $config, OutputInterface $output) { |
|
149 | + function (FilesInterface $files, TranslatorConfig $config, OutputInterface $output) |
|
150 | + { |
|
142 | 151 | $files->ensureDirectory($config->getLocaleDirectory($config->getDefaultLocale())); |
143 | 152 | $output->writeln("<info>The default locale directory has been ensured.</info>"); |
144 | 153 | }, |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function testMountFileNotFound() |
24 | 24 | { |
25 | 25 | $out = $this->runCommand('encrypt:key', [ |
26 | - '-m' => __DIR__ . '/.env' |
|
26 | + '-m' => __DIR__.'/.env' |
|
27 | 27 | ]); |
28 | 28 | |
29 | 29 | $this->assertContains('Unable to find', $out); |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | |
32 | 32 | public function testReplace() |
33 | 33 | { |
34 | - file_put_contents(__DIR__ . '/.env', '{encrypt-key}'); |
|
34 | + file_put_contents(__DIR__.'/.env', '{encrypt-key}'); |
|
35 | 35 | |
36 | 36 | $out = $this->runCommand('encrypt:key', [ |
37 | - '-m' => __DIR__ . '/.env' |
|
37 | + '-m' => __DIR__.'/.env' |
|
38 | 38 | ]); |
39 | 39 | |
40 | 40 | $this->assertContains('key has been updated', $out); |
41 | 41 | |
42 | - $body = file_get_contents(__DIR__ . '/.env'); |
|
42 | + $body = file_get_contents(__DIR__.'/.env'); |
|
43 | 43 | $this->assertContains($body, $out); |
44 | 44 | |
45 | - unlink(__DIR__ . '/.env'); |
|
45 | + unlink(__DIR__.'/.env'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function testReplaceCurrent() |
@@ -53,18 +53,18 @@ discard block |
||
53 | 53 | 'ENCRYPTER_KEY' => $key |
54 | 54 | ]); |
55 | 55 | |
56 | - file_put_contents(__DIR__ . '/.env', $key); |
|
56 | + file_put_contents(__DIR__.'/.env', $key); |
|
57 | 57 | |
58 | 58 | $out = $app->console()->run('encrypt:key', [ |
59 | - '-m' => __DIR__ . '/.env' |
|
59 | + '-m' => __DIR__.'/.env' |
|
60 | 60 | ]); |
61 | 61 | $out = $out->getOutput()->fetch(); |
62 | 62 | |
63 | 63 | $this->assertContains('key has been updated', $out); |
64 | 64 | |
65 | - $body = file_get_contents(__DIR__ . '/.env'); |
|
65 | + $body = file_get_contents(__DIR__.'/.env'); |
|
66 | 66 | $this->assertContains($body, $out); |
67 | 67 | |
68 | - unlink(__DIR__ . '/.env'); |
|
68 | + unlink(__DIR__.'/.env'); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | \ No newline at end of file |