| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 26 | public function fromDocker(): Mounts |
||
| 27 | { |
||
| 28 | if (null === $this->mounts) { |
||
| 29 | $this->process->run(); |
||
| 30 | if (!$this->process->isSuccessful()) { |
||
| 31 | $error = $this->process->getErrorOutput(); |
||
| 32 | if (false !== strpos($error, 'var/run/docker.sock')) { |
||
| 33 | throw HostException::noSocketMount($this->process->getErrorOutput()); |
||
| 34 | } else { |
||
| 35 | throw new HostException($error); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | $this->mounts = json_decode($this->process->getOutput(), true); |
||
| 39 | } |
||
| 40 | |||
| 41 | return new Mounts($this->mounts); |
||
| 42 | } |
||
| 44 | } |