Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
35 | 20 | public static function normalize(string $path): string |
|
36 | { |
||
37 | 20 | $search = ['//', '\\\\', '\\']; |
|
38 | 20 | $replace = ['/', '\\', '/']; |
|
39 | 20 | while (($processedPath = str_replace($search, $replace, $path)) !== $path) { |
|
40 | 14 | $path = $processedPath; |
|
41 | } |
||
42 | |||
43 | 20 | return rtrim($path, '/'); |
|
44 | } |
||
46 |