| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 28 | public function prePersist(LifecycleEventArgs $args): void |
|
| 15 | { |
||
| 16 | 28 | $entity = $args->getEntity(); |
|
| 17 | |||
| 18 | 28 | if (is_a($entity, CreatedEntityInterface::class)) { |
|
| 19 | /** @var CreatedEntityInterface $createdEntity */ |
||
| 20 | 28 | $createdEntity = $entity; |
|
| 21 | 28 | if (null === $createdEntity->getCreated()) { |
|
| 22 | 28 | $createdEntity->setCreated(new DateTime()); |
|
| 23 | } |
||
| 24 | } |
||
| 25 | 28 | } |
|
| 26 | } |
||
| 27 |