| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3.009 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 16 | 5 | public static function basePath($controller) |
|
| 17 | { |
||
| 18 | /** @noinspection PhpUnhandledExceptionInspection */ |
||
| 19 | 5 | $reflection = new \ReflectionClass($controller); |
|
| 20 | 5 | $path = dirname($reflection->getFileName()); |
|
| 21 | 5 | $parts = explode(DIRECTORY_SEPARATOR, $path); |
|
| 22 | 5 | while (count($parts) > 1) { |
|
| 23 | 5 | $lastPart = end($parts); |
|
| 24 | 5 | if (strtolower($lastPart) == 'controllers') { |
|
| 25 | 5 | return implode(DIRECTORY_SEPARATOR, $parts); |
|
| 26 | } |
||
| 27 | 3 | array_pop($parts); |
|
| 28 | } |
||
| 29 | return false; |
||
| 30 | } |
||
| 32 |