| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | final public function changeWorkingDirectory(InputInterface $input): void |
||
| 30 | { |
||
| 31 | $workingDir = $input->getOption(self::$WORKING_DIR_OPT); |
||
| 32 | |||
| 33 | if (null === $workingDir) { |
||
| 34 | return; |
||
| 35 | } |
||
| 36 | |||
| 37 | Assertion::directory( |
||
| 38 | $workingDir, |
||
| 39 | 'Could not change the working directory to "%s": directory does not exists or file is not a directory.' |
||
| 40 | ); |
||
| 41 | |||
| 42 | if (false === chdir($workingDir)) { |
||
| 43 | throw new RuntimeException( |
||
| 44 | sprintf( |
||
| 45 | 'Failed to change the working directory to "%s" from "%s".', |
||
| 46 | $workingDir, |
||
| 47 | getcwd() |
||
| 48 | ) |
||
| 64 |