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