Conditions | 3 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
41 | protected function execute(InputInterface $input, OutputInterface $output) |
||
42 | { |
||
43 | $file = $input->getArgument('config-file'); |
||
44 | |||
45 | // Test if config file exists |
||
46 | if (!file_exists($file) || !is_readable($file)) { |
||
47 | $msg = "Configuration file '$file' does not exists or is not readable'"; |
||
48 | throw new \InvalidArgumentException($msg); |
||
49 | } |
||
50 | $params = include($file); |
||
51 | $port = $params['port']; |
||
52 | |||
53 | $config = new StandaloneServer\Config($params); |
||
54 | $this->server = new StandaloneServer($config); |
||
55 | |||
56 | $this->server->stop(); |
||
57 | |||
58 | $output->write("Server running on port $port successfully stopped" . PHP_EOL); |
||
59 | } |
||
60 | } |
||
61 |