| Conditions | 2 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function register(): void |
||
| 24 | { |
||
| 25 | 1 | $this->getContainer()->share(IntentManager::class, function () { |
|
| 26 | /** @var Config $config */ |
||
| 27 | 1 | $config = $this->getContainer()->get(Config::class); |
|
| 28 | |||
| 29 | /** @var array $intents */ |
||
| 30 | 1 | $intents = $config->get('intents', []); |
|
| 31 | |||
| 32 | /** @var string $fallbackIntent */ |
||
| 33 | 1 | $fallbackIntent = $config->get('fallback_intent', FallbackIntent::class); |
|
| 34 | |||
| 35 | 1 | $manager = new IntentManager(); |
|
| 36 | |||
| 37 | 1 | foreach ($intents as $intent) { |
|
| 38 | 1 | $manager->add($this->getContainer()->get($intent)); |
|
| 39 | } |
||
| 40 | |||
| 41 | 1 | $manager->setFallbackIntent($this->getContainer()->get($fallbackIntent)); |
|
| 42 | |||
| 43 | 1 | return $manager; |
|
| 44 | 1 | }); |
|
| 45 | 1 | } |
|
| 46 | } |
||
| 47 |