@@ -41,7 +41,7 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function getValue(string $source, string $name = null) |
| 43 | 43 | { |
| 44 | - if (!method_exists($this->input, $source)) { |
|
| 44 | + if (!method_exists($this->input, $source)){ |
|
| 45 | 45 | throw new InputException("Undefined input source '{$source}'"); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -41,7 +41,8 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function getValue(string $source, string $name = null) |
| 43 | 43 | { |
| 44 | - if (!method_exists($this->input, $source)) { |
|
| 44 | + if (!method_exists($this->input, $source)) |
|
| 45 | + { |
|
| 45 | 46 | throw new InputException("Undefined input source '{$source}'"); |
| 46 | 47 | } |
| 47 | 48 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function perform(Console $console) |
| 28 | 28 | { |
| 29 | - if (!$this->verifyEnvironment()) { |
|
| 29 | + if (!$this->verifyEnvironment()){ |
|
| 30 | 30 | //Making sure we can safely migrate in this environment |
| 31 | 31 | return; |
| 32 | 32 | } |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | $rollback = ['--force' => true]; |
| 35 | 35 | $migrate = ['--force' => true]; |
| 36 | 36 | |
| 37 | - if ($this->option('all')) { |
|
| 37 | + if ($this->option('all')){ |
|
| 38 | 38 | $rollback['--all'] = true; |
| 39 | - } else { |
|
| 39 | + }else{ |
|
| 40 | 40 | $migrate['--one'] = true; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -26,7 +26,8 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function perform(Console $console) |
| 28 | 28 | { |
| 29 | - if (!$this->verifyEnvironment()) { |
|
| 29 | + if (!$this->verifyEnvironment()) |
|
| 30 | + { |
|
| 30 | 31 | //Making sure we can safely migrate in this environment |
| 31 | 32 | return; |
| 32 | 33 | } |
@@ -34,9 +35,12 @@ discard block |
||
| 34 | 35 | $rollback = ['--force' => true]; |
| 35 | 36 | $migrate = ['--force' => true]; |
| 36 | 37 | |
| 37 | - if ($this->option('all')) { |
|
| 38 | + if ($this->option('all')) |
|
| 39 | + { |
|
| 38 | 40 | $rollback['--all'] = true; |
| 39 | - } else { |
|
| 41 | + } |
|
| 42 | + else |
|
| 43 | + { |
|
| 40 | 44 | $migrate['--one'] = true; |
| 41 | 45 | } |
| 42 | 46 | |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | $generator = new ContextGenerator($views->getContext()); |
| 35 | 35 | |
| 36 | 36 | $contexts = $generator->generate(); |
| 37 | - if (empty($contexts)) { |
|
| 37 | + if (empty($contexts)){ |
|
| 38 | 38 | $contexts[] = $views->getContext(); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - foreach ($contexts as $context) { |
|
| 42 | - foreach ($views->getEngines() as $engine) { |
|
| 41 | + foreach ($contexts as $context){ |
|
| 42 | + foreach ($views->getEngines() as $engine){ |
|
| 43 | 43 | $this->compile($engine, $context); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -59,17 +59,17 @@ discard block |
||
| 59 | 59 | $this->describeContext($context) ?? "default" |
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | - foreach ($engine->getLoader()->list() as $path) { |
|
| 63 | - try { |
|
| 62 | + foreach ($engine->getLoader()->list() as $path){ |
|
| 63 | + try{ |
|
| 64 | 64 | $start = microtime(true); |
| 65 | 65 | $engine->reset($path, $context); |
| 66 | 66 | $engine->compile($path, $context); |
| 67 | 67 | |
| 68 | - if ($this->isVerbose()) { |
|
| 68 | + if ($this->isVerbose()){ |
|
| 69 | 69 | $this->sprintf("<info>•</info> %s", $path); |
| 70 | 70 | } |
| 71 | - } catch (\Throwable $e) { |
|
| 72 | - if ($this->isVerbose()) { |
|
| 71 | + }catch (\Throwable $e){ |
|
| 72 | + if ($this->isVerbose()){ |
|
| 73 | 73 | $this->sprintf( |
| 74 | 74 | "<fg=red>•</fg=red> %s: <fg=red>%s at line %s</fg=red>", |
| 75 | 75 | $path, |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | ); |
| 79 | 79 | } |
| 80 | 80 | continue; |
| 81 | - } finally { |
|
| 82 | - if ($this->isVerbose()) { |
|
| 81 | + }finally{ |
|
| 82 | + if ($this->isVerbose()){ |
|
| 83 | 83 | $this->sprintf( |
| 84 | 84 | " %s[%s ms]%s\n", |
| 85 | 85 | Color::GRAY, |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if ($this->isVerbose()) { |
|
| 94 | - if (empty($path)) { |
|
| 93 | + if ($this->isVerbose()){ |
|
| 94 | + if (empty($path)){ |
|
| 95 | 95 | $this->writeln("• no views found"); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $values = []; |
| 109 | 109 | |
| 110 | - foreach ($context->getDependencies() as $dependency) { |
|
| 110 | + foreach ($context->getDependencies() as $dependency){ |
|
| 111 | 111 | $values[] = sprintf( |
| 112 | 112 | "%s%s%s:%s%s%s", |
| 113 | 113 | Color::LIGHT_WHITE, |
@@ -34,12 +34,15 @@ discard block |
||
| 34 | 34 | $generator = new ContextGenerator($views->getContext()); |
| 35 | 35 | |
| 36 | 36 | $contexts = $generator->generate(); |
| 37 | - if (empty($contexts)) { |
|
| 37 | + if (empty($contexts)) |
|
| 38 | + { |
|
| 38 | 39 | $contexts[] = $views->getContext(); |
| 39 | 40 | } |
| 40 | 41 | |
| 41 | - foreach ($contexts as $context) { |
|
| 42 | - foreach ($views->getEngines() as $engine) { |
|
| 42 | + foreach ($contexts as $context) |
|
| 43 | + { |
|
| 44 | + foreach ($views->getEngines() as $engine) |
|
| 45 | + { |
|
| 43 | 46 | $this->compile($engine, $context); |
| 44 | 47 | } |
| 45 | 48 | } |
@@ -59,17 +62,23 @@ discard block |
||
| 59 | 62 | $this->describeContext($context) ?? "default" |
| 60 | 63 | ); |
| 61 | 64 | |
| 62 | - foreach ($engine->getLoader()->list() as $path) { |
|
| 63 | - try { |
|
| 65 | + foreach ($engine->getLoader()->list() as $path) |
|
| 66 | + { |
|
| 67 | + try |
|
| 68 | + { |
|
| 64 | 69 | $start = microtime(true); |
| 65 | 70 | $engine->reset($path, $context); |
| 66 | 71 | $engine->compile($path, $context); |
| 67 | 72 | |
| 68 | - if ($this->isVerbose()) { |
|
| 73 | + if ($this->isVerbose()) |
|
| 74 | + { |
|
| 69 | 75 | $this->sprintf("<info>•</info> %s", $path); |
| 70 | 76 | } |
| 71 | - } catch (\Throwable $e) { |
|
| 72 | - if ($this->isVerbose()) { |
|
| 77 | + } |
|
| 78 | + catch (\Throwable $e) |
|
| 79 | + { |
|
| 80 | + if ($this->isVerbose()) |
|
| 81 | + { |
|
| 73 | 82 | $this->sprintf( |
| 74 | 83 | "<fg=red>•</fg=red> %s: <fg=red>%s at line %s</fg=red>", |
| 75 | 84 | $path, |
@@ -78,8 +87,11 @@ discard block |
||
| 78 | 87 | ); |
| 79 | 88 | } |
| 80 | 89 | continue; |
| 81 | - } finally { |
|
| 82 | - if ($this->isVerbose()) { |
|
| 90 | + } |
|
| 91 | + finally |
|
| 92 | + { |
|
| 93 | + if ($this->isVerbose()) |
|
| 94 | + { |
|
| 83 | 95 | $this->sprintf( |
| 84 | 96 | " %s[%s ms]%s\n", |
| 85 | 97 | Color::GRAY, |
@@ -90,8 +102,10 @@ discard block |
||
| 90 | 102 | } |
| 91 | 103 | } |
| 92 | 104 | |
| 93 | - if ($this->isVerbose()) { |
|
| 94 | - if (empty($path)) { |
|
| 105 | + if ($this->isVerbose()) |
|
| 106 | + { |
|
| 107 | + if (empty($path)) |
|
| 108 | + { |
|
| 95 | 109 | $this->writeln("• no views found"); |
| 96 | 110 | } |
| 97 | 111 | |
@@ -107,7 +121,8 @@ discard block |
||
| 107 | 121 | { |
| 108 | 122 | $values = []; |
| 109 | 123 | |
| 110 | - foreach ($context->getDependencies() as $dependency) { |
|
| 124 | + foreach ($context->getDependencies() as $dependency) |
|
| 125 | + { |
|
| 111 | 126 | $values[] = sprintf( |
| 112 | 127 | "%s%s%s:%s%s%s", |
| 113 | 128 | Color::LIGHT_WHITE, |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function perform(DatabaseConfig $config, DatabaseManager $dbal) |
| 34 | 34 | { |
| 35 | - if ($this->argument('db')) { |
|
| 35 | + if ($this->argument('db')){ |
|
| 36 | 36 | $databases = [$this->argument('db')]; |
| 37 | - } else { |
|
| 37 | + }else{ |
|
| 38 | 38 | $databases = array_keys($config->getDatabases()); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if (empty($databases)) { |
|
| 41 | + if (empty($databases)){ |
|
| 42 | 42 | $this->writeln("<fg=red>No databases found.</fg=red>"); |
| 43 | 43 | |
| 44 | 44 | return; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | 'Count Records:' |
| 55 | 55 | ]); |
| 56 | 56 | |
| 57 | - foreach ($databases as $database) { |
|
| 57 | + foreach ($databases as $database){ |
|
| 58 | 58 | $database = $dbal->database($database); |
| 59 | 59 | |
| 60 | 60 | /** @var Driver $driver */ |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | $database->getPrefix() ?: '<comment>---</comment>' |
| 68 | 68 | ]; |
| 69 | 69 | |
| 70 | - try { |
|
| 70 | + try{ |
|
| 71 | 71 | $driver->connect(); |
| 72 | - } catch (\Exception $exception) { |
|
| 72 | + }catch (\Exception $exception){ |
|
| 73 | 73 | $this->renderException($grid, $header, $exception); |
| 74 | 74 | |
| 75 | - if ($database->getName() != end($databases)) { |
|
| 75 | + if ($database->getName() != end($databases)){ |
|
| 76 | 76 | $grid->addRow(new TableSeparator()); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $header[] = "<info>connected</info>"; |
| 83 | 83 | $this->renderTables($grid, $header, $database); |
| 84 | - if ($database->getName() != end($databases)) { |
|
| 84 | + if ($database->getName() != end($databases)){ |
|
| 85 | 85 | $grid->addRow(new TableSeparator()); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | private function renderTables(Table $grid, array $header, Database $database) |
| 115 | 115 | { |
| 116 | - foreach ($database->getTables() as $table) { |
|
| 116 | + foreach ($database->getTables() as $table){ |
|
| 117 | 117 | $grid->addRow(array_merge( |
| 118 | 118 | $header, |
| 119 | 119 | [$table->getName(), number_format($table->count())] |
@@ -32,13 +32,17 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function perform(DatabaseConfig $config, DatabaseManager $dbal) |
| 34 | 34 | { |
| 35 | - if ($this->argument('db')) { |
|
| 35 | + if ($this->argument('db')) |
|
| 36 | + { |
|
| 36 | 37 | $databases = [$this->argument('db')]; |
| 37 | - } else { |
|
| 38 | + } |
|
| 39 | + else |
|
| 40 | + { |
|
| 38 | 41 | $databases = array_keys($config->getDatabases()); |
| 39 | 42 | } |
| 40 | 43 | |
| 41 | - if (empty($databases)) { |
|
| 44 | + if (empty($databases)) |
|
| 45 | + { |
|
| 42 | 46 | $this->writeln("<fg=red>No databases found.</fg=red>"); |
| 43 | 47 | |
| 44 | 48 | return; |
@@ -54,7 +58,8 @@ discard block |
||
| 54 | 58 | 'Count Records:' |
| 55 | 59 | ]); |
| 56 | 60 | |
| 57 | - foreach ($databases as $database) { |
|
| 61 | + foreach ($databases as $database) |
|
| 62 | + { |
|
| 58 | 63 | $database = $dbal->database($database); |
| 59 | 64 | |
| 60 | 65 | /** @var Driver $driver */ |
@@ -67,12 +72,16 @@ discard block |
||
| 67 | 72 | $database->getPrefix() ?: '<comment>---</comment>' |
| 68 | 73 | ]; |
| 69 | 74 | |
| 70 | - try { |
|
| 75 | + try |
|
| 76 | + { |
|
| 71 | 77 | $driver->connect(); |
| 72 | - } catch (\Exception $exception) { |
|
| 78 | + } |
|
| 79 | + catch (\Exception $exception) |
|
| 80 | + { |
|
| 73 | 81 | $this->renderException($grid, $header, $exception); |
| 74 | 82 | |
| 75 | - if ($database->getName() != end($databases)) { |
|
| 83 | + if ($database->getName() != end($databases)) |
|
| 84 | + { |
|
| 76 | 85 | $grid->addRow(new TableSeparator()); |
| 77 | 86 | } |
| 78 | 87 | |
@@ -81,7 +90,8 @@ discard block |
||
| 81 | 90 | |
| 82 | 91 | $header[] = "<info>connected</info>"; |
| 83 | 92 | $this->renderTables($grid, $header, $database); |
| 84 | - if ($database->getName() != end($databases)) { |
|
| 93 | + if ($database->getName() != end($databases)) |
|
| 94 | + { |
|
| 85 | 95 | $grid->addRow(new TableSeparator()); |
| 86 | 96 | } |
| 87 | 97 | } |
@@ -113,7 +123,8 @@ discard block |
||
| 113 | 123 | */ |
| 114 | 124 | private function renderTables(Table $grid, array $header, Database $database) |
| 115 | 125 | { |
| 116 | - foreach ($database->getTables() as $table) { |
|
| 126 | + foreach ($database->getTables() as $table) |
|
| 127 | + { |
|
| 117 | 128 | $grid->addRow(array_merge( |
| 118 | 129 | $header, |
| 119 | 130 | [$table->getName(), number_format($table->count())] |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | GenerateMigrations $migrations, |
| 49 | 49 | Migrator $migrator, |
| 50 | 50 | Console $console |
| 51 | - ) { |
|
| 52 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
| 51 | + ){ |
|
| 52 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()){ |
|
| 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() || !$this->verifyEnvironment()) { |
|
| 52 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()) |
|
| 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 | } |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | SchemaBootloader $bootloader, |
| 32 | 32 | Registry $registry, |
| 33 | 33 | MemoryInterface $memory |
| 34 | - ) { |
|
| 35 | - if (!$this->verifyEnvironment()) { |
|
| 34 | + ){ |
|
| 35 | + if (!$this->verifyEnvironment()){ |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $memory->saveData('cycle', $schema); |
| 47 | 47 | |
| 48 | - if ($show->hasChanges()) { |
|
| 48 | + if ($show->hasChanges()){ |
|
| 49 | 49 | $this->writeln("\n<info>ORM Schema has been synchronized</info>"); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -32,7 +32,8 @@ discard block |
||
| 32 | 32 | Registry $registry, |
| 33 | 33 | MemoryInterface $memory |
| 34 | 34 | ) { |
| 35 | - if (!$this->verifyEnvironment()) { |
|
| 35 | + if (!$this->verifyEnvironment()) |
|
| 36 | + { |
|
| 36 | 37 | return; |
| 37 | 38 | } |
| 38 | 39 | |
@@ -45,7 +46,8 @@ discard block |
||
| 45 | 46 | |
| 46 | 47 | $memory->saveData('cycle', $schema); |
| 47 | 48 | |
| 48 | - if ($show->hasChanges()) { |
|
| 49 | + if ($show->hasChanges()) |
|
| 50 | + { |
|
| 49 | 51 | $this->writeln("\n<info>ORM Schema has been synchronized</info>"); |
| 50 | 52 | } |
| 51 | 53 | |
@@ -25,20 +25,20 @@ discard block |
||
| 25 | 25 | public function perform(FilesInterface $files, DirectoriesInterface $directories) |
| 26 | 26 | { |
| 27 | 27 | $cacheDirectory = $directories->get('cache'); |
| 28 | - if (!$files->exists($cacheDirectory)) { |
|
| 28 | + if (!$files->exists($cacheDirectory)){ |
|
| 29 | 29 | $this->writeln("Cache directory is missing, no cache to be cleaned."); |
| 30 | 30 | |
| 31 | 31 | return; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if ($this->isVerbose()) { |
|
| 34 | + if ($this->isVerbose()){ |
|
| 35 | 35 | $this->writeln("<info>Cleaning application cache:</info>"); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - foreach ($files->getFiles($cacheDirectory) as $filename) { |
|
| 39 | - try { |
|
| 38 | + foreach ($files->getFiles($cacheDirectory) as $filename){ |
|
| 39 | + try{ |
|
| 40 | 40 | $files->delete($filename); |
| 41 | - } catch (\Throwable $e) { |
|
| 41 | + }catch (\Throwable $e){ |
|
| 42 | 42 | $this->sprintf("<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
| 43 | 43 | $files->relativePath($filename, $cacheDirectory), |
| 44 | 44 | $e->getMessage() |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if ($this->isVerbose()) { |
|
| 50 | + if ($this->isVerbose()){ |
|
| 51 | 51 | $this->sprintf( |
| 52 | 52 | "<fg=green>[deleted]</fg=green> `%s`\n", |
| 53 | 53 | $files->relativePath($filename, $cacheDirectory) |
@@ -25,20 +25,26 @@ discard block |
||
| 25 | 25 | public function perform(FilesInterface $files, DirectoriesInterface $directories) |
| 26 | 26 | { |
| 27 | 27 | $cacheDirectory = $directories->get('cache'); |
| 28 | - if (!$files->exists($cacheDirectory)) { |
|
| 28 | + if (!$files->exists($cacheDirectory)) |
|
| 29 | + { |
|
| 29 | 30 | $this->writeln("Cache directory is missing, no cache to be cleaned."); |
| 30 | 31 | |
| 31 | 32 | return; |
| 32 | 33 | } |
| 33 | 34 | |
| 34 | - if ($this->isVerbose()) { |
|
| 35 | + if ($this->isVerbose()) |
|
| 36 | + { |
|
| 35 | 37 | $this->writeln("<info>Cleaning application cache:</info>"); |
| 36 | 38 | } |
| 37 | 39 | |
| 38 | - foreach ($files->getFiles($cacheDirectory) as $filename) { |
|
| 39 | - try { |
|
| 40 | + foreach ($files->getFiles($cacheDirectory) as $filename) |
|
| 41 | + { |
|
| 42 | + try |
|
| 43 | + { |
|
| 40 | 44 | $files->delete($filename); |
| 41 | - } catch (\Throwable $e) { |
|
| 45 | + } |
|
| 46 | + catch (\Throwable $e) |
|
| 47 | + { |
|
| 42 | 48 | $this->sprintf("<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
| 43 | 49 | $files->relativePath($filename, $cacheDirectory), |
| 44 | 50 | $e->getMessage() |
@@ -47,7 +53,8 @@ discard block |
||
| 47 | 53 | continue; |
| 48 | 54 | } |
| 49 | 55 | |
| 50 | - if ($this->isVerbose()) { |
|
| 56 | + if ($this->isVerbose()) |
|
| 57 | + { |
|
| 51 | 58 | $this->sprintf( |
| 52 | 59 | "<fg=green>[deleted]</fg=green> `%s`\n", |
| 53 | 60 | $files->relativePath($filename, $cacheDirectory) |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | Publisher $publisher, |
| 54 | 54 | FilesInterface $files, |
| 55 | 55 | DirectoriesInterface $directories |
| 56 | - ) { |
|
| 57 | - switch ($this->argument('type')) { |
|
| 56 | + ){ |
|
| 57 | + switch ($this->argument('type')){ |
|
| 58 | 58 | case 'replace': |
| 59 | 59 | case 'follow': |
| 60 | - if ($this->isDirectory()) { |
|
| 60 | + if ($this->isDirectory()){ |
|
| 61 | 61 | $this->sprintf( |
| 62 | 62 | "<fg=cyan>•</fg=cyan> publish directory <comment>%s</comment> to <comment>%s</comment>", |
| 63 | 63 | $this->getSource($files, $directories), |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $this->getMergeMode(), |
| 71 | 71 | $this->getFileMode() |
| 72 | 72 | ); |
| 73 | - } else { |
|
| 73 | + }else{ |
|
| 74 | 74 | $this->sprintf( |
| 75 | 75 | "<fg=cyan>•</fg=cyan> publish file <comment>%s</comment> to <comment>%s</comment>", |
| 76 | 76 | $this->getSource($files, $directories), |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | private function getSource(FilesInterface $files, DirectoriesInterface $directories): ?string |
| 110 | 110 | { |
| 111 | - if (!$this->isDirectory()) { |
|
| 111 | + if (!$this->isDirectory()){ |
|
| 112 | 112 | return $files->normalizePath($this->argument('source')); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | private function getTarget(FilesInterface $files, DirectoriesInterface $directories): ?string |
| 124 | 124 | { |
| 125 | 125 | $target = $this->argument('target'); |
| 126 | - foreach ($directories->getAll() as $alias => $value) { |
|
| 126 | + foreach ($directories->getAll() as $alias => $value){ |
|
| 127 | 127 | $target = str_replace("@{$alias}", $value, $target); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | private function isDirectory(): bool |
| 137 | 137 | { |
| 138 | - if ($this->argument('type') == 'ensure') { |
|
| 138 | + if ($this->argument('type') == 'ensure'){ |
|
| 139 | 139 | return true; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if (strpos($this->argument('source'), '*') !== false) { |
|
| 142 | + if (strpos($this->argument('source'), '*') !== false){ |
|
| 143 | 143 | return true; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | private function getMergeMode(): string |
| 153 | 153 | { |
| 154 | - switch ($this->argument('type')) { |
|
| 154 | + switch ($this->argument('type')){ |
|
| 155 | 155 | case 'follow': |
| 156 | 156 | return PublisherInterface::FOLLOW; |
| 157 | 157 | case 'replace': |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | private function getFileMode(): int |
| 168 | 168 | { |
| 169 | - switch ($this->argument('mode')) { |
|
| 169 | + switch ($this->argument('mode')){ |
|
| 170 | 170 | case 'readonly': |
| 171 | 171 | return FilesInterface::READONLY; |
| 172 | 172 | case 'runtime': |
@@ -54,10 +54,12 @@ discard block |
||
| 54 | 54 | FilesInterface $files, |
| 55 | 55 | DirectoriesInterface $directories |
| 56 | 56 | ) { |
| 57 | - switch ($this->argument('type')) { |
|
| 57 | + switch ($this->argument('type')) |
|
| 58 | + { |
|
| 58 | 59 | case 'replace': |
| 59 | 60 | case 'follow': |
| 60 | - if ($this->isDirectory()) { |
|
| 61 | + if ($this->isDirectory()) |
|
| 62 | + { |
|
| 61 | 63 | $this->sprintf( |
| 62 | 64 | "<fg=cyan>•</fg=cyan> publish directory <comment>%s</comment> to <comment>%s</comment>", |
| 63 | 65 | $this->getSource($files, $directories), |
@@ -70,7 +72,9 @@ discard block |
||
| 70 | 72 | $this->getMergeMode(), |
| 71 | 73 | $this->getFileMode() |
| 72 | 74 | ); |
| 73 | - } else { |
|
| 75 | + } |
|
| 76 | + else |
|
| 77 | + { |
|
| 74 | 78 | $this->sprintf( |
| 75 | 79 | "<fg=cyan>•</fg=cyan> publish file <comment>%s</comment> to <comment>%s</comment>", |
| 76 | 80 | $this->getSource($files, $directories), |
@@ -108,7 +112,8 @@ discard block |
||
| 108 | 112 | */ |
| 109 | 113 | private function getSource(FilesInterface $files, DirectoriesInterface $directories): ?string |
| 110 | 114 | { |
| 111 | - if (!$this->isDirectory()) { |
|
| 115 | + if (!$this->isDirectory()) |
|
| 116 | + { |
|
| 112 | 117 | return $files->normalizePath($this->argument('source')); |
| 113 | 118 | } |
| 114 | 119 | |
@@ -123,7 +128,8 @@ discard block |
||
| 123 | 128 | private function getTarget(FilesInterface $files, DirectoriesInterface $directories): ?string |
| 124 | 129 | { |
| 125 | 130 | $target = $this->argument('target'); |
| 126 | - foreach ($directories->getAll() as $alias => $value) { |
|
| 131 | + foreach ($directories->getAll() as $alias => $value) |
|
| 132 | + { |
|
| 127 | 133 | $target = str_replace("@{$alias}", $value, $target); |
| 128 | 134 | } |
| 129 | 135 | |
@@ -135,11 +141,13 @@ discard block |
||
| 135 | 141 | */ |
| 136 | 142 | private function isDirectory(): bool |
| 137 | 143 | { |
| 138 | - if ($this->argument('type') == 'ensure') { |
|
| 144 | + if ($this->argument('type') == 'ensure') |
|
| 145 | + { |
|
| 139 | 146 | return true; |
| 140 | 147 | } |
| 141 | 148 | |
| 142 | - if (strpos($this->argument('source'), '*') !== false) { |
|
| 149 | + if (strpos($this->argument('source'), '*') !== false) |
|
| 150 | + { |
|
| 143 | 151 | return true; |
| 144 | 152 | } |
| 145 | 153 | |
@@ -151,7 +159,8 @@ discard block |
||
| 151 | 159 | */ |
| 152 | 160 | private function getMergeMode(): string |
| 153 | 161 | { |
| 154 | - switch ($this->argument('type')) { |
|
| 162 | + switch ($this->argument('type')) |
|
| 163 | + { |
|
| 155 | 164 | case 'follow': |
| 156 | 165 | return PublisherInterface::FOLLOW; |
| 157 | 166 | case 'replace': |
@@ -166,7 +175,8 @@ discard block |
||
| 166 | 175 | */ |
| 167 | 176 | private function getFileMode(): int |
| 168 | 177 | { |
| 169 | - switch ($this->argument('mode')) { |
|
| 178 | + switch ($this->argument('mode')) |
|
| 179 | + { |
|
| 170 | 180 | case 'readonly': |
| 171 | 181 | return FilesInterface::READONLY; |
| 172 | 182 | case 'runtime': |
@@ -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 | ); |