Conditions | 2 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | public static function joinPaths(...$parts) |
||
14 | { |
||
15 | $combined = null; |
||
16 | $parts = array_filter($parts); |
||
17 | array_walk_recursive($parts, function ($part) use (&$combined) { |
||
18 | // Normalise path |
||
19 | $part = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $part); |
||
20 | $combined = $combined |
||
21 | ? (rtrim($combined, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $part) |
||
22 | : $part; |
||
23 | }); |
||
24 | return $combined; |
||
25 | } |
||
27 |