| Conditions | 7 |
| Paths | 15 |
| Total Lines | 26 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 18 | public function getFields(\ReflectionClass $class): array |
||
| 19 | { |
||
| 20 | $fields = []; |
||
| 21 | |||
| 22 | foreach ($class->getProperties() as $property) { |
||
| 23 | foreach ($this->getPropertyAnnotations($property) as $annotation) { |
||
| 24 | if ($annotation instanceof ExportAssociationField) { |
||
| 25 | $fieldName = $property->getName() . '.' . $annotation->getField(); |
||
| 26 | |||
| 27 | $fields[$annotation->label ?? $fieldName] = $fieldName; |
||
| 28 | continue; |
||
| 29 | } |
||
| 30 | |||
| 31 | if ($annotation instanceof ExportField) { |
||
| 32 | $fields[$annotation->label ?? $property->getName()] = $property->getName(); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | foreach ($class->getMethods() as $method) { |
||
| 38 | if ($annotation = $this->getMethodAnnotation($method, ExportField::class)) { |
||
| 39 | $fields[$annotation->label ?? $method->getName()] = $method->getName(); |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | return $fields; |
||
| 44 | } |
||
| 55 |