Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
AiAssistantsService
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 getConfig
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace Drupal\visitors\Service;
6
7use Drupal\visitors\VisitorsAiAssistantsInterface;
8
9/**
10 * Service for matching hostnames to AI assistants.
11 */
12final class AiAssistantsService extends HostnameMatcherServiceBase implements VisitorsAiAssistantsInterface {
13
14  /**
15   * {@inheritdoc}
16   */
17  protected function getConfig(): array {
18    if ($this->cachedConfig === NULL) {
19      $config = $this->configFactory->get('visitors.ai_assistants');
20      $this->cachedConfig = $config->get('sites') ?? [];
21    }
22
23    return $this->cachedConfig;
24  }
25
26}