Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
41 | public static function getEntityIdType(string $entity): string |
||
42 | { |
||
43 | $type = ''; |
||
44 | $reflectionClassName = new \ReflectionClass($entity); |
||
45 | foreach ($reflectionClassName->getProperties() as $property) { |
||
46 | /** @var Id $id */ |
||
47 | $id = (new AnnotationReader()) |
||
48 | ->getPropertyAnnotation($property, Id::class); |
||
49 | if (!empty($id)) { |
||
50 | /** @var Column $column */ |
||
51 | $column = (new AnnotationReader()) |
||
52 | ->getPropertyAnnotation($property, Column::class); |
||
53 | if ($column) { |
||
54 | $type = $column->type; |
||
55 | } |
||
56 | break; |
||
57 | } |
||
58 | } |
||
59 | |||
60 | return $type; |
||
61 | } |
||
63 |