| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public function __construct(Process $process) |
||
| 14 | { |
||
| 15 | if ($process->isSuccessful()) { |
||
| 16 | throw new InvalidArgumentException('Expected a failed process, but the given process was successful.'); |
||
| 17 | } |
||
| 18 | |||
| 19 | $error = sprintf('The command "%s" failed.', $process->getInput()); |
||
| 20 | |||
| 21 | if (!$process->isOutputDisabled()) { |
||
| 22 | $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", |
||
| 23 | $process->getOutput(), |
||
| 24 | $process->getErrorOutput() |
||
| 25 | ); |
||
| 26 | } |
||
| 27 | |||
| 28 | parent::__construct($error); |
||
| 29 | |||
| 30 | $this->process = $process; |
||
| 31 | } |
||
| 32 | |||
| 38 |