Total Complexity | 4 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
13 | class EntityID |
||
14 | { |
||
15 | /** |
||
16 | * @var EntityManager |
||
17 | */ |
||
18 | private $entityManager; |
||
19 | |||
20 | /** |
||
21 | * The entity class name |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | private $className; |
||
26 | |||
27 | /** |
||
28 | * The entity id |
||
29 | * |
||
30 | * @var null|string |
||
31 | */ |
||
32 | private $id; |
||
33 | |||
34 | 6 | public function __construct(EntityManager $entityManager, string $className, ?string $id) |
|
39 | 6 | } |
|
40 | |||
41 | /** |
||
42 | * Get the ID |
||
43 | * |
||
44 | * @return null|string |
||
45 | */ |
||
46 | 2 | public function getId(): ?string |
|
47 | { |
||
48 | 2 | return $this->id; |
|
49 | } |
||
50 | |||
51 | /** |
||
52 | * Get the entity from DB |
||
53 | * |
||
54 | * @throws Error |
||
55 | * |
||
56 | * @return mixed entity |
||
57 | */ |
||
58 | 4 | public function getEntity() |
|
66 | } |
||
67 | } |
||
68 |