Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | public static function guessNamespace($root) |
||
42 | { |
||
43 | if (!defined('APP_PATH')) { |
||
44 | return null; |
||
45 | } |
||
46 | |||
47 | $method = 'get'.ucfirst($root).'Directory'; |
||
48 | |||
49 | $path = Config::getInstance()->$method(); |
||
50 | |||
51 | $appPathArray = explode('/', APP_PATH); |
||
52 | |||
53 | $relativePath = array_diff(explode('/', $path), $appPathArray); |
||
54 | |||
55 | array_unshift($relativePath, array_pop($appPathArray)); |
||
56 | |||
57 | return implode('\\', array_map('ucfirst', $relativePath)); |
||
58 | } |
||
59 | } |
||
60 |