Total Complexity | 5 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Coverage | 15.38% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
8 | class ExtensionRegistry implements ExtensionRegistryInterface |
||
9 | { |
||
10 | /** |
||
11 | * @var array<string, ExtensionInterface> |
||
12 | */ |
||
13 | private $extensions = []; |
||
14 | |||
15 | 18 | public function __construct() |
|
16 | { |
||
17 | 18 | } |
|
18 | |||
19 | public function addExtension(ExtensionInterface $extension): void |
||
20 | { |
||
21 | $id = $extension->getIdentifier(); |
||
22 | if (isset($this->extensions[$id])) { |
||
23 | throw new ConfigurationException(sprintf('Extension with identifier %s is already registered.', $id)); |
||
24 | } |
||
25 | $this->extensions[$id] = $extension; |
||
26 | } |
||
27 | |||
28 | public function getExtension(string $extensionId): ExtensionInterface |
||
35 | } |
||
36 | } |
||
37 |