| Total Complexity | 3 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | class DomainFilteringAdapter implements EmbedAdapterInterface |
||
| 17 | { |
||
| 18 | private EmbedAdapterInterface $decorated; |
||
| 19 | |||
| 20 | private string $regex; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param string[] $allowedDomains |
||
| 24 | */ |
||
| 25 | 6 | public function __construct(EmbedAdapterInterface $decorated, array $allowedDomains) |
|
| 26 | { |
||
| 27 | 6 | $this->decorated = $decorated; |
|
| 28 | 6 | $this->regex = self::createRegex($allowedDomains); |
|
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * {@inheritDoc} |
||
| 33 | */ |
||
| 34 | 6 | public function updateEmbeds(array $embeds): void |
|
| 38 | })); |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @param string[] $allowedDomains |
||
| 43 | */ |
||
| 44 | 6 | private static function createRegex(array $allowedDomains): string |
|
| 51 |