| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 3.3332 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 22 | 1 | public function hydrate(array $data, string $class) : Collection |
|
| 23 | { |
||
| 24 | 1 | if (empty($data) === true) { |
|
| 25 | throw new \ErrorException('Data is empty'); |
||
| 26 | } |
||
| 27 | |||
| 28 | 1 | if (is_subclass_of($class, DataInterface::class) === false) { |
|
| 29 | throw new \ErrorException('class is not implemented from DataInterface'); |
||
| 30 | } |
||
| 31 | |||
| 32 | 1 | return call_user_func($class . '::create', $data); |
|
| 33 | } |
||
| 34 | } |