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