| Conditions | 8 |
| Paths | 16 |
| Total Lines | 34 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 19 | public function createProperties(string $resourceClass): array |
||
| 20 | { |
||
| 21 | $metadata = $this->metadataHelper->findMetadata($resourceClass); |
||
| 22 | $properties = []; |
||
| 23 | |||
| 24 | if ($metadata === null) { |
||
| 25 | return $properties; |
||
| 26 | } |
||
| 27 | |||
| 28 | foreach ($metadata->getFieldNames() as $fieldName) { |
||
| 29 | $fieldType = $metadata->getTypeOfField($fieldName); |
||
| 30 | |||
| 31 | if (str_contains($fieldType, 'datetime')) { |
||
|
|
|||
| 32 | $properties[$fieldName] = new DateProperty($fieldName); |
||
| 33 | } elseif ($fieldType === 'boolean') { |
||
| 34 | $properties[$fieldName] = new BooleanProperty($fieldName); |
||
| 35 | } else { |
||
| 36 | $properties[$fieldName] = new StringProperty($fieldName); |
||
| 37 | } |
||
| 38 | |||
| 39 | if (\count($properties) > 10) { |
||
| 40 | return $properties; |
||
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 | foreach ($metadata->getAssociationNames() as $associationName) { |
||
| 45 | $properties[$associationName] = new CountProperty($associationName); |
||
| 46 | |||
| 47 | if (\count($properties) > 10) { |
||
| 48 | return $properties; |
||
| 49 | } |
||
| 50 | } |
||
| 51 | |||
| 52 | return $properties; |
||
| 53 | } |
||
| 55 |