@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $this->addOption('name', 'e', InputOption::VALUE_REQUIRED, 'Server name'); |
| 31 | 31 | |
| 32 | - $this->addOption('ip', 'i', InputOption::VALUE_REQUIRED, 'Server ip address'); |
|
| 32 | + $this->addOption('ip', 'i', InputOption::VALUE_REQUIRED, 'Server ip address'); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param InputInterface $input |
| 39 | 39 | * @param OutputInterface $output |
| 40 | 40 | */ |
| 41 | - protected function execute(InputInterface $input , OutputInterface $output) |
|
| 41 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 42 | 42 | { |
| 43 | 43 | $command = new Style($input, $output); |
| 44 | 44 | |
@@ -47,25 +47,25 @@ discard block |
||
| 47 | 47 | $ip = $input->getOption('ip'); |
| 48 | 48 | $name = $input->getOption('name'); |
| 49 | 49 | |
| 50 | - if (empty($name) || empty($ip)){ |
|
| 50 | + if (empty($name) || empty($ip)) { |
|
| 51 | 51 | |
| 52 | 52 | $command->error("Server name and ip address is required. use [server:add --ip=***.***.*** --name=example]"); |
| 53 | 53 | } else { |
| 54 | 54 | |
| 55 | 55 | /** @var Server $server */ |
| 56 | - foreach ($servers as $server){ |
|
| 57 | - if ( $server->getAttribute("name") == $name ) { |
|
| 56 | + foreach ($servers as $server) { |
|
| 57 | + if ($server->getAttribute("name") == $name) { |
|
| 58 | 58 | $command->error("Server {$name} already exists."); |
| 59 | 59 | exit; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if ( $server->getAttribute("ip") == $ip ) { |
|
| 62 | + if ($server->getAttribute("ip") == $ip) { |
|
| 63 | 63 | $command->error("Server IP {$ip} already exists."); |
| 64 | 64 | exit; |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $id = ( $servers->count() == 0 ? 1 : array_reverse($servers->toArray())[0]->id + 1 ); |
|
| 68 | + $id = ($servers->count() == 0 ? 1 : array_reverse($servers->toArray())[0]->id + 1); |
|
| 69 | 69 | |
| 70 | 70 | $this->model->create(compact("id", "ip", "name")); |
| 71 | 71 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param InputInterface $input |
| 37 | 37 | * @param OutputInterface $output |
| 38 | 38 | */ |
| 39 | - protected function execute(InputInterface $input , OutputInterface $output) |
|
| 39 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 40 | 40 | { |
| 41 | 41 | $command = new Style($input, $output); |
| 42 | 42 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $server = $this->model->findBy("name", $serverIdOrName); |
| 50 | 50 | |
| 51 | - $server = ( $server->exists() ? $server : $this->model->findBy("id", $serverIdOrName) ); |
|
| 51 | + $server = ($server->exists() ? $server : $this->model->findBy("id", $serverIdOrName)); |
|
| 52 | 52 | |
| 53 | 53 | $ip = $server->getAttribute("ip"); |
| 54 | 54 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function getHomeDir() |
| 70 | 70 | { |
| 71 | - if(empty($_SERVER['HOME'])){ |
|
| 71 | + if (empty($_SERVER['HOME'])) { |
|
| 72 | 72 | return posix_getpwuid(posix_getuid()); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * @param InputInterface $input |
| 35 | 35 | * @param OutputInterface $output |
| 36 | 36 | */ |
| 37 | - protected function execute(InputInterface $input , OutputInterface $output) |
|
| 37 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 38 | 38 | { |
| 39 | 39 | $command = new Style($input, $output); |
| 40 | 40 | |