Conditions | 3 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3.0416 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
41 | 2 | protected function execute(InputInterface $input, OutputInterface $output) |
|
42 | { |
||
43 | 2 | $file = $input->getArgument('config-file'); |
|
44 | |||
45 | // Test if config file exists |
||
46 | 2 | 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 | 2 | $params = include($file); |
|
51 | 2 | $port = $params['port']; |
|
52 | |||
53 | 2 | $config = new StandaloneServer\Config($params); |
|
54 | 2 | $this->server = new StandaloneServer($config); |
|
55 | |||
56 | 2 | $this->server->stop(); |
|
57 | |||
58 | 2 | $output->write("Server running on port $port successfully stopped" . PHP_EOL); |
|
59 | 2 | } |
|
60 | } |
||
61 |