| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 4 | public function getAgenda(string $name): AbstractAgenda |
|
| 22 | { |
||
| 23 | 4 | $className = $this->getClassName($name); |
|
| 24 | 4 | if (!$this->container->has($className)) { |
|
| 25 | 1 | throw new DomainException('Agenda class does not exists: ' . $name); |
|
| 26 | } |
||
| 27 | |||
| 28 | try { |
||
| 29 | 3 | $instance = $this->container->get($className); |
|
| 30 | 1 | } catch (ContainerExceptionInterface $ex) { |
|
| 31 | 1 | throw new DomainException('Agenda class initialization failed: ' . $name, 0, $ex); |
|
| 32 | } |
||
| 33 | |||
| 34 | 2 | if ($instance instanceof AbstractAgenda) { |
|
| 35 | 1 | return $instance; |
|
| 36 | } |
||
| 37 | |||
| 38 | 1 | throw new DomainException('Agenda class is not an instance of AbstractAgenda: ' . $name); |
|
| 39 | } |
||
| 41 |