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