Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | public static function getProjectRoot(InputInterface $input): ProjectRoot |
||
32 | { |
||
33 | $projectRootAsString = CliConfigReader::getOption($input, self::PROJECT_ROOT); |
||
34 | |||
35 | $cwd = getcwd(); |
||
36 | if (false === $cwd) { |
||
37 | // Impossible to easily test `cwd` failing, to exclude from tests. |
||
38 | throw new SarbException('Can not get current working directory. Specify project root with options: '.self::PROJECT_ROOT); // @codeCoverageIgnore |
||
39 | } |
||
40 | |||
41 | if (null === $projectRootAsString) { |
||
42 | $projectRootAsString = $cwd; |
||
43 | } |
||
44 | |||
45 | return new ProjectRoot($projectRootAsString, $cwd); |
||
46 | } |
||
48 |