| Conditions | 3 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | 10 | public static function checkDirectory(string $directory): string |
|
| 33 | { |
||
| 34 | 10 | $dir = realpath($directory); |
|
| 35 | |||
| 36 | 10 | if (false === $dir) { |
|
| 37 | 10 | mkdir( |
|
| 38 | 10 | $directory, |
|
| 39 | 10 | 0777, |
|
| 40 | 10 | true |
|
| 41 | ); |
||
| 42 | 10 | $dir = realpath($directory); |
|
| 43 | } |
||
| 44 | |||
| 45 | 10 | if (false === $dir) { |
|
| 46 | // @codeCoverageIgnoreStart |
||
| 47 | throw new Exception("Can't get directory $directory."); |
||
| 48 | // @codeCoverageIgnoreEnd |
||
| 49 | } |
||
| 50 | |||
| 51 | 10 | return $dir; |
|
| 52 | } |
||
| 80 |