Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0175 |
Changes | 0 |
1 | <?php |
||
50 | 4 | public function make(string $code) |
|
51 | { |
||
52 | 4 | if (empty($this->config)) { |
|
53 | throw new ConfigurationException('Фабрика не инициализирована'); |
||
54 | } |
||
55 | |||
56 | 4 | if (! $this->entityExists($code)) { |
|
57 | 1 | throw new FactoryException('Фабрика не может сделать такую сущность'); |
|
58 | } |
||
59 | |||
60 | 3 | $resolved = new $this->config[$code]; |
|
61 | |||
62 | 3 | Assert::isInstanceOf($resolved, $this->allowedType); |
|
63 | |||
64 | 3 | return $resolved; |
|
65 | } |
||
79 |