| Conditions | 4 |
| Paths | 5 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | 607 | public function create(string $class): ModelFactory |
|
| 23 | { |
||
| 24 | 607 | foreach ($this->factories as $factory) { |
|
| 25 | 240 | if ($class === \get_class($factory)) { |
|
| 26 | 96 | return $factory; |
|
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | try { |
||
| 31 | 585 | return new $class(); |
|
| 32 | 6 | } catch (\ArgumentCountError $e) { |
|
| 33 | 6 | throw new \RuntimeException('Model Factories with dependencies (Model Factory services) cannot be used without the foundry bundle.', 0, $e); |
|
| 34 | } |
||
| 37 |