| Total Complexity | 9 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | final class IdentifierMapping implements IdentifierMappingInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var IdentifierConfig[] |
||
| 11 | */ |
||
| 12 | private $mapping; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Mapping should be in the form of: |
||
| 16 | * <code> |
||
| 17 | * [ |
||
| 18 | * 'identifier' => [ 'hostnames' => [], 'locales' => [] ] |
||
| 19 | * ] |
||
| 20 | * </code>. |
||
| 21 | * |
||
| 22 | * @param array $mapping mapping from identifier to matching request part |
||
| 23 | */ |
||
| 24 | public function __construct(array $mapping) |
||
| 25 | { |
||
| 26 | foreach ($mapping as $identifier => $config) { |
||
| 27 | $this->mapping[$identifier] = new IdentifierConfig($config['hostnames'], $config['locales']); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | public function findIdentifierByHostname(string $hostname): ?string |
||
| 40 | } |
||
| 41 | |||
| 42 | public function findHostnamesByIdentifier(string $identifier, ?string $locale = null): array |
||
| 57 |