Total Complexity | 7 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php declare(strict_types=1); |
||
12 | abstract class AbstractConfigurableHostHelper extends AbstractSiteHelper |
||
13 | { |
||
14 | public function addHost(string $host): void |
||
15 | { |
||
16 | $this->addHosts([$host]); |
||
17 | } |
||
18 | |||
19 | public function addHosts(array $hosts): void |
||
20 | { |
||
21 | $siteId = $this->getSiteId(); |
||
22 | if (!isset($this->configurator->registeredVars['MediaEmbed.sites'][$siteId])) |
||
23 | { |
||
24 | $this->configurator->MediaEmbed->add($siteId); |
||
25 | } |
||
26 | |||
27 | foreach ($hosts as $host) |
||
28 | { |
||
29 | $host = strtolower($host); |
||
30 | $this->configurator->registeredVars['MediaEmbed.hosts'][$host] = $siteId; |
||
31 | } |
||
32 | } |
||
33 | |||
34 | abstract protected function getSiteId(): string; |
||
35 | |||
36 | public function setHosts(array $hosts): void |
||
56 | } |
||
57 | } |