@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | string $header, |
| 94 | 94 | string $footer = '', |
| 95 | 95 | array $options = [] |
| 96 | - ) { |
|
| 96 | + ){ |
|
| 97 | 97 | $this->config->modify( |
| 98 | 98 | 'console', |
| 99 | 99 | $this->sequence('configure', $sequence, $header, $footer, $options) |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | string $header, |
| 112 | 112 | string $footer = '', |
| 113 | 113 | array $options = [] |
| 114 | - ) { |
|
| 114 | + ){ |
|
| 115 | 115 | $this->config->modify( |
| 116 | 116 | 'console', |
| 117 | 117 | $this->sequence('update', $sequence, $header, $footer, $options) |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | string $footer, |
| 134 | 134 | array $options |
| 135 | 135 | ): Append { |
| 136 | - if (is_array($sequence) || $sequence instanceof \Closure) { |
|
| 136 | + if (is_array($sequence) || $sequence instanceof \Closure){ |
|
| 137 | 137 | return new Append( |
| 138 | 138 | $target, |
| 139 | 139 | null, |
@@ -133,7 +133,8 @@ |
||
| 133 | 133 | string $footer, |
| 134 | 134 | array $options |
| 135 | 135 | ): Append { |
| 136 | - if (is_array($sequence) || $sequence instanceof \Closure) { |
|
| 136 | + if (is_array($sequence) || $sequence instanceof \Closure) |
|
| 137 | + { |
|
| 137 | 138 | return new Append( |
| 138 | 139 | $target, |
| 139 | 140 | null, |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | PermissionsInterface $permissions, |
| 41 | 41 | ContainerInterface $actorScope, |
| 42 | 42 | array $roles = [] |
| 43 | - ) { |
|
| 43 | + ){ |
|
| 44 | 44 | $this->roles = $roles; |
| 45 | 45 | $this->container = $actorScope; |
| 46 | 46 | $this->permissions = $permissions; |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | public function allows(string $permission, array $context = []): bool |
| 53 | 53 | { |
| 54 | 54 | $allows = false; |
| 55 | - foreach ($this->getRoles() as $role) { |
|
| 56 | - if (!$this->permissions->hasRole($role)) { |
|
| 55 | + foreach ($this->getRoles() as $role){ |
|
| 56 | + if (!$this->permissions->hasRole($role)){ |
|
| 57 | 57 | continue; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function getActor(): ActorInterface |
| 101 | 101 | { |
| 102 | - if (!is_null($this->actor)) { |
|
| 102 | + if (!is_null($this->actor)){ |
|
| 103 | 103 | return $this->actor; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - try { |
|
| 106 | + try{ |
|
| 107 | 107 | return $this->container->get(ActorInterface::class); |
| 108 | - } catch (ContainerException $e) { |
|
| 108 | + }catch (ContainerException $e){ |
|
| 109 | 109 | throw new ScopeException("Unable to resolve Actor from the scope", $e->getCode(), $e); |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -52,8 +52,10 @@ discard block |
||
| 52 | 52 | public function allows(string $permission, array $context = []): bool |
| 53 | 53 | { |
| 54 | 54 | $allows = false; |
| 55 | - foreach ($this->getRoles() as $role) { |
|
| 56 | - if (!$this->permissions->hasRole($role)) { |
|
| 55 | + foreach ($this->getRoles() as $role) |
|
| 56 | + { |
|
| 57 | + if (!$this->permissions->hasRole($role)) |
|
| 58 | + { |
|
| 57 | 59 | continue; |
| 58 | 60 | } |
| 59 | 61 | |
@@ -99,13 +101,17 @@ discard block |
||
| 99 | 101 | */ |
| 100 | 102 | public function getActor(): ActorInterface |
| 101 | 103 | { |
| 102 | - if (!is_null($this->actor)) { |
|
| 104 | + if (!is_null($this->actor)) |
|
| 105 | + { |
|
| 103 | 106 | return $this->actor; |
| 104 | 107 | } |
| 105 | 108 | |
| 106 | - try { |
|
| 109 | + try |
|
| 110 | + { |
|
| 107 | 111 | return $this->container->get(ActorInterface::class); |
| 108 | - } catch (ContainerException $e) { |
|
| 112 | + } |
|
| 113 | + catch (ContainerException $e) |
|
| 114 | + { |
|
| 109 | 115 | throw new ScopeException("Unable to resolve Actor from the scope", $e->getCode(), $e); |
| 110 | 116 | } |
| 111 | 117 | } |
@@ -39,11 +39,13 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | protected function mapDirectories(array $directories): array |
| 41 | 41 | { |
| 42 | - if (!isset($directories['root'])) { |
|
| 42 | + if (!isset($directories['root'])) |
|
| 43 | + { |
|
| 43 | 44 | throw new BootException("Missing required directory `root`."); |
| 44 | 45 | } |
| 45 | 46 | |
| 46 | - if (!isset($directories['app'])) { |
|
| 47 | + if (!isset($directories['app'])) |
|
| 48 | + { |
|
| 47 | 49 | $directories['app'] = $directories['root'] . '/app/'; |
| 48 | 50 | } |
| 49 | 51 | |
@@ -43,28 +43,28 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | protected function mapDirectories(array $directories): array |
| 45 | 45 | { |
| 46 | - if (!isset($directories['root'])) { |
|
| 46 | + if (!isset($directories['root'])){ |
|
| 47 | 47 | throw new BootException("Missing required directory `root`."); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if (!isset($directories['app'])) { |
|
| 51 | - $directories['app'] = $directories['root'] . '/app/'; |
|
| 50 | + if (!isset($directories['app'])){ |
|
| 51 | + $directories['app'] = $directories['root'].'/app/'; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | return array_merge([ |
| 55 | 55 | // public root |
| 56 | - 'public' => $directories['root'] . '/public/', |
|
| 56 | + 'public' => $directories['root'].'/public/', |
|
| 57 | 57 | |
| 58 | 58 | // vendor libraries |
| 59 | - 'vendor' => $directories['root'] . '/vendor/', |
|
| 59 | + 'vendor' => $directories['root'].'/vendor/', |
|
| 60 | 60 | |
| 61 | 61 | // data directories |
| 62 | - 'runtime' => $directories['root'] . '/runtime/', |
|
| 63 | - 'cache' => $directories['root'] . '/runtime/cache/', |
|
| 62 | + 'runtime' => $directories['root'].'/runtime/', |
|
| 63 | + 'cache' => $directories['root'].'/runtime/cache/', |
|
| 64 | 64 | |
| 65 | 65 | // application directories |
| 66 | - 'config' => $directories['app'] . '/config/', |
|
| 67 | - 'resources' => $directories['app'] . '/resources/', |
|
| 66 | + 'config' => $directories['app'].'/config/', |
|
| 67 | + 'resources' => $directories['app'].'/resources/', |
|
| 68 | 68 | ], $directories); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | int $verbosity, |
| 49 | 49 | HandlerInterface $handler, |
| 50 | 50 | FilesInterface $files |
| 51 | - ) { |
|
| 51 | + ){ |
|
| 52 | 52 | $this->directory = $directory; |
| 53 | 53 | $this->maxFiles = $maxFiles; |
| 54 | 54 | $this->verbosity = $verbosity; |
@@ -92,17 +92,17 @@ discard block |
||
| 92 | 92 | protected function rotateSnapshots() |
| 93 | 93 | { |
| 94 | 94 | $finder = new Finder(); |
| 95 | - $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b) { |
|
| 95 | + $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b){ |
|
| 96 | 96 | return $b->getMTime() - $a->getMTime(); |
| 97 | 97 | }); |
| 98 | 98 | |
| 99 | 99 | $count = 0; |
| 100 | - foreach ($finder as $file) { |
|
| 100 | + foreach ($finder as $file){ |
|
| 101 | 101 | $count++; |
| 102 | - if ($count > $this->maxFiles) { |
|
| 103 | - try { |
|
| 102 | + if ($count > $this->maxFiles){ |
|
| 103 | + try{ |
|
| 104 | 104 | $this->files->delete($file->getRealPath()); |
| 105 | - } catch (FilesException $e) { |
|
| 105 | + }catch (FilesException $e){ |
|
| 106 | 106 | // ignore |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -92,17 +92,23 @@ |
||
| 92 | 92 | protected function rotateSnapshots() |
| 93 | 93 | { |
| 94 | 94 | $finder = new Finder(); |
| 95 | - $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b) { |
|
| 95 | + $finder->in($this->directory)->sort(function (SplFileInfo $a, SplFileInfo $b) |
|
| 96 | + { |
|
| 96 | 97 | return $b->getMTime() - $a->getMTime(); |
| 97 | 98 | }); |
| 98 | 99 | |
| 99 | 100 | $count = 0; |
| 100 | - foreach ($finder as $file) { |
|
| 101 | + foreach ($finder as $file) |
|
| 102 | + { |
|
| 101 | 103 | $count++; |
| 102 | - if ($count > $this->maxFiles) { |
|
| 103 | - try { |
|
| 104 | + if ($count > $this->maxFiles) |
|
| 105 | + { |
|
| 106 | + try |
|
| 107 | + { |
|
| 104 | 108 | $this->files->delete($file->getRealPath()); |
| 105 | - } catch (FilesException $e) { |
|
| 109 | + } |
|
| 110 | + catch (FilesException $e) |
|
| 111 | + { |
|
| 106 | 112 | // ignore |
| 107 | 113 | } |
| 108 | 114 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | protected function authorize(string $permission, array $context = []): bool |
| 32 | 32 | { |
| 33 | - if (!$this->allows($permission, $context)) { |
|
| 33 | + if (!$this->allows($permission, $context)){ |
|
| 34 | 34 | $name = $this->resolvePermission($permission); |
| 35 | 35 | |
| 36 | 36 | throw new ControllerException( |
@@ -30,7 +30,8 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | protected function authorize(string $permission, array $context = []): bool |
| 32 | 32 | { |
| 33 | - if (!$this->allows($permission, $context)) { |
|
| 33 | + if (!$this->allows($permission, $context)) |
|
| 34 | + { |
|
| 34 | 35 | $name = $this->resolvePermission($permission); |
| 35 | 36 | |
| 36 | 37 | throw new ControllerException( |
@@ -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 | |
@@ -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())] |
@@ -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': |