| Total Complexity | 6 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | class ServeCommand extends Command |
||
| 19 | { |
||
| 20 | /** @var string */ |
||
| 21 | protected $signature = 'serve {--host=localhost} {--port= : <comment> [default: 8080] </comment>}'; |
||
| 22 | |||
| 23 | /** @var string */ |
||
| 24 | protected $description = 'Start the realtime compiler server.'; |
||
| 25 | |||
| 26 | public function handle(): int |
||
| 27 | { |
||
| 28 | $this->line('<info>Starting the HydeRC server...</info> Press Ctrl+C to stop'); |
||
| 29 | |||
| 30 | $this->runServerProcess(sprintf('php -S %s:%d %s', |
||
| 31 | $this->option('host'), |
||
| 32 | $this->getPortSelection() ?: 8080, |
||
| 33 | $this->getExecutablePath() |
||
| 34 | )); |
||
| 35 | |||
| 36 | return Command::SUCCESS; |
||
| 37 | } |
||
| 38 | |||
| 39 | protected function getPortSelection(): int |
||
| 42 | } |
||
| 43 | |||
| 44 | protected function getExecutablePath(): string |
||
| 47 | } |
||
| 48 | |||
| 49 | protected function runServerProcess(string $command): void |
||
| 56 |