| Total Complexity | 5 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 7 | class MachineState |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var MachineName |
||
| 11 | */ |
||
| 12 | private $machineName; |
||
| 13 | |||
| 14 | public function __construct(MachineName $machineName) |
||
| 17 | } |
||
| 18 | |||
| 19 | public function exists(): bool |
||
| 20 | { |
||
| 21 | $process = Process::fromShellCommandline('docker-machine ls -q --filter="name=${MACHINE_NAME}"'); |
||
| 22 | $process->run(); |
||
| 23 | if ($process->isSuccessful()) { |
||
| 24 | return $this->machineName->toString() === trim($process->getOutput()); |
||
| 25 | } |
||
| 26 | |||
| 27 | return false; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function isRunning(): bool |
||
| 41 | } |
||
| 42 | } |
||
| 43 |