| Total Complexity | 5 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | class AppFactory |
||
| 28 | { |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Supported adapters |
||
| 32 | */ |
||
| 33 | const ADAPTERS = [ |
||
| 34 | App::WEB => WebAppAdapter::class, |
||
| 35 | App::CONSOLE => ConsoleAppAdapter::class, |
||
| 36 | ]; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @var array |
||
| 40 | */ |
||
| 41 | private static $instances = []; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @param string $type |
||
| 45 | * @param string $baseDir |
||
| 46 | * @return App |
||
| 47 | * @throws BaseException |
||
| 48 | */ |
||
| 49 | public static function create(string $type, string $baseDir): App |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @param string $type |
||
| 61 | * @return void |
||
| 62 | */ |
||
| 63 | public static function destroy(string $type) |
||
| 64 | { |
||
| 65 | unset(self::$instances[$type]); |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @param string $type |
||
| 70 | * @param string $baseDir |
||
| 71 | * @return App |
||
| 72 | * @throws BaseException |
||
| 73 | */ |
||
| 74 | private static function createInstance(string $type, string $baseDir): App |
||
| 85 | } |
||
| 86 | } |