| Conditions | 2 |
| Paths | 1 |
| Total Lines | 8 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function createEntity($entityClassName, array $data) |
||
| 15 | { |
||
| 16 | // Try to fix strange Dibi datetime behaviour by using standard (and immutable!) datetime class |
||
| 17 | 1 | $data = array_map(function($column) { |
|
| 18 | 1 | return ($column instanceof \DateTime) ? \DateTimeImmutable::createFromMutable($column) : $column; |
|
| 19 | 1 | }, $data); |
|
| 20 | |||
| 21 | 1 | return new $entityClassName($data); |
|
| 22 | } |
||
| 24 |