Conditions | 3 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
33 | 16 | private function getReducedPath($path, $currFolderPath) { |
|
34 | // Adding a slash to make sure we don't cut a folder in half |
||
35 | 16 | if ($currFolderPath) { |
|
36 | 13 | $currFolderPath .= '/'; |
|
37 | 13 | $relativePath = str_replace($currFolderPath, '', $path); |
|
38 | } else { |
||
39 | 3 | $relativePath = $path; |
|
40 | } |
||
41 | |||
42 | 16 | $subFolders = explode('/', $relativePath); |
|
43 | |||
44 | 16 | if (count($subFolders) > 2) { |
|
45 | 3 | $reducedPath = $currFolderPath . $subFolders[0] . '/' . array_pop($subFolders); |
|
46 | } else { |
||
47 | 13 | $reducedPath = $path; |
|
48 | } |
||
49 | |||
50 | 16 | return $reducedPath; |
|
51 | } |
||
52 | |||
54 |