| Total Complexity | 9 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 15 | class Component extends BaseObject implements BootstrapInterface |
||
| 16 | { |
||
| 17 | public string $environment = 'dev'; |
||
| 18 | public array $controllerMap = [ |
||
| 19 | 'ide-components' => Controller::class, |
||
| 20 | ]; |
||
| 21 | public ?string $result = null; |
||
| 22 | public ?array $config = null; |
||
| 23 | public ?string $webAppClass = null; |
||
| 24 | public ?string $consoleAppClass = null; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @inheritdoc |
||
| 28 | */ |
||
| 29 | public function bootstrap($app) |
||
| 30 | { |
||
| 31 | if ($app instanceof \yii\console\Application && $this->isActive()) { |
||
| 32 | $this->updateControllerMap($app); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | public function isActive(): bool |
||
| 37 | { |
||
| 38 | return defined('YII_ENV') && YII_ENV === $this->environment; |
||
| 39 | } |
||
| 40 | |||
| 41 | protected function updateControllerMap(Application $app): void |
||
| 47 | } |
||
| 48 | } |
||
| 49 | } |
||
| 52 |