| Total Complexity | 4 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | class EntityID |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @param class-string<T> $className the entity class name |
||
| 19 | * @param null|string $id the entity id |
||
| 20 | */ |
||
| 21 | 6 | public function __construct( |
|
| 22 | private readonly EntityManager $entityManager, |
||
| 23 | private readonly string $className, |
||
| 24 | private readonly ?string $id, |
||
| 25 | 6 | ) {} |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Get the ID. |
||
| 29 | */ |
||
| 30 | 2 | public function getId(): ?string |
|
| 31 | { |
||
| 32 | 2 | return $this->id; |
|
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Get the entity from DB. |
||
| 37 | * |
||
| 38 | * @return T entity |
||
| 39 | */ |
||
| 40 | 4 | public function getEntity(): object |
|
| 48 | } |
||
| 49 | } |
||
| 50 |