| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2.0078 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 12 | 3 | public function execute(CommandParams $params, CommandExecutionContext $executionContext): string |
|
| 13 | { |
||
| 14 | 3 | $fileName = $params->getFirstArgument(); |
|
| 15 | |||
| 16 | 3 | if (!$executionContext->hasFileInWorkingDirectory($fileName)) { |
|
| 17 | throw new ExecutionFailedException("File '$fileName' does not exist."); |
||
| 18 | } |
||
| 19 | |||
| 20 | 3 | $path = $executionContext->getPathOfFileInWorkingDirectory($fileName); |
|
| 21 | |||
| 22 | 3 | $cmd = sprintf('php %s 2>&1', escapeshellarg($path)); |
|
| 23 | 3 | $output = shell_exec($cmd); |
|
| 24 | |||
| 25 | 3 | return $this->wrapOutput($output); |
|
| 26 | } |
||
| 27 | |||
| 39 |