Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
18 | public static function getEntityIdName(string $entity): ?string |
||
19 | { |
||
20 | $name = ''; |
||
21 | $reflectionClassName = new \ReflectionClass($entity); |
||
22 | foreach ($reflectionClassName->getProperties() as $property) { |
||
23 | /** @var Id $id */ |
||
24 | $id = (new AnnotationReader()) |
||
25 | ->getPropertyAnnotation($property, Id::class); |
||
26 | if (!empty($id)) { |
||
27 | $name = $property->getName(); |
||
28 | break; |
||
29 | } |
||
30 | } |
||
31 | |||
32 | return $name; |
||
33 | } |
||
63 |