Conditions | 4 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
18 | public function getProjectDir(): string |
||
19 | { |
||
20 | if ($this->projectDir === null) { |
||
21 | $r = new \ReflectionClass($_SERVER['KERNEL_CLASS']); |
||
22 | $dir = $rootDir = \dirname($r->getFileName()); |
||
23 | while (!file_exists($dir . '/composer.json')) { |
||
24 | if ($dir === \dirname($dir)) { |
||
25 | return $this->projectDir = $rootDir; |
||
26 | } |
||
27 | $dir = \dirname($dir); |
||
28 | } |
||
29 | $this->projectDir = $dir; |
||
30 | } |
||
31 | |||
32 | return $this->projectDir; |
||
33 | } |
||
54 |