Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | public static function getAncestorDirForFile($filePath, $fileName) |
||
39 | { |
||
40 | $path = $filePath; |
||
41 | |||
42 | $rootPath = ''; |
||
43 | |||
44 | while (true) { |
||
45 | if ($path === \DIRECTORY_SEPARATOR) { |
||
46 | break; |
||
47 | } |
||
48 | |||
49 | if (\is_file(PathUtils::composePath($path, $fileName))) { |
||
50 | $rootPath = $path; |
||
51 | } |
||
52 | |||
53 | $path = \dirname($path); |
||
54 | } |
||
55 | |||
56 | return $rootPath; |
||
57 | } |
||
59 |