Total Complexity | 5 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 7 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | final class Gacela |
||
16 | { |
||
17 | /** |
||
18 | * Define the entry point of Gacela. |
||
19 | * |
||
20 | * @param null|Closure(GacelaConfig):void $configFn |
||
21 | */ |
||
22 | 51 | public static function bootstrap(string $appRootDir, Closure $configFn = null): void |
|
23 | { |
||
24 | 51 | $setup = self::processConfigFnIntoSetup($appRootDir, $configFn); |
|
25 | |||
26 | 51 | if (!$setup->isCacheEnabled()) { |
|
27 | 9 | ClassNameCache::resetCache(); |
|
28 | 9 | AbstractClassResolver::resetCache(); |
|
29 | 9 | Config::resetInstance(); |
|
30 | } |
||
31 | |||
32 | 51 | Config::getInstance() |
|
33 | 51 | ->setAppRootDir($appRootDir) |
|
34 | 51 | ->setSetup($setup) |
|
35 | 51 | ->init(); |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * @param null|Closure(GacelaConfig):void $configFn |
||
40 | */ |
||
41 | 51 | private static function processConfigFnIntoSetup(string $appRootDir, Closure $configFn = null): SetupGacelaInterface |
|
54 | } |
||
55 | } |
||
56 |