Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
57 | 4 | public static function getSubPathOf(array $subDir, array $parentDir) : string |
|
58 | { |
||
59 | 4 | if (!self::isSubDirectoryOf($subDir, $parentDir)) { |
|
60 | 1 | throw new \RuntimeException('Invalid sub directory'); |
|
61 | } |
||
62 | |||
63 | 3 | $path = []; |
|
64 | 3 | foreach (array_slice($subDir, count($parentDir)) as $dir) { |
|
65 | 3 | $path[] = $dir; |
|
66 | } |
||
67 | 3 | return implode(DIRECTORY_SEPARATOR, $path); |
|
68 | } |
||
69 | } |
||
70 |