| Total Complexity | 9 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | class DownWAMP extends Command |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * {@inheritdoc} |
||
| 24 | */ |
||
| 25 | protected $signature = 'wamp:stop {--server-only} {--client-only}'; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * {@inheritdoc} |
||
| 29 | */ |
||
| 30 | protected $description = 'Stop all background running server & clients |
||
| 31 | {--server-only : Stop only running server instances} |
||
| 32 | {--client-only : Stop only running client instances} |
||
| 33 | '; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Handle command |
||
| 37 | * |
||
| 38 | * @author Donii Sergii <[email protected]> |
||
| 39 | */ |
||
| 40 | 2 | public function fire() { |
|
| 41 | 2 | $clientsOnly = $this->option('client-only'); |
|
| 42 | 2 | $serversOnly = $this->option('server-only'); |
|
| 43 | |||
| 44 | 2 | if (!$serversOnly) { |
|
| 45 | 1 | $this->stopInstances(storage_path('clients.pids')); |
|
|
|
|||
| 46 | } |
||
| 47 | |||
| 48 | 2 | if (!$clientsOnly) { |
|
| 49 | 1 | $this->stopInstances(storage_path('servers.pids')); |
|
| 50 | } |
||
| 51 | 2 | } |
|
| 52 | |||
| 53 | /** |
||
| 54 | * Handle command alias |
||
| 55 | * |
||
| 56 | * @author Donii Sergii <[email protected]> |
||
| 57 | */ |
||
| 58 | 2 | public function handle() { |
|
| 60 | 2 | } |
|
| 61 | |||
| 62 | 2 | private function stopInstances($file) { |
|
| 76 | } |
||
| 77 | } |
||
| 81 | } |