| Total Complexity | 3 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | final class CollectorRegistry |
||
| 9 | { |
||
| 10 | /** @var MetricCollectorInterface[] */ |
||
| 11 | private $collectors = []; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Add collector to registry. |
||
| 15 | * |
||
| 16 | * @param string $name |
||
| 17 | * @param MetricCollectorInterface $collector |
||
| 18 | */ |
||
| 19 | 1 | public function register(string $name, MetricCollectorInterface $collector): void |
|
| 20 | { |
||
| 21 | 1 | $this->collectors[$name] = $collector; |
|
| 22 | 1 | } |
|
| 23 | |||
| 24 | /** |
||
| 25 | * Fetch collector from registry. |
||
| 26 | * |
||
| 27 | * @param string $name |
||
| 28 | * |
||
| 29 | * @return MetricCollectorInterface |
||
| 30 | * |
||
| 31 | * @throws \OutOfBoundsException |
||
| 32 | */ |
||
| 33 | 2 | public function getCollector(string $name): MetricCollectorInterface |
|
| 40 | } |
||
| 41 | } |
||
| 42 |