| Conditions | 5 |
| Paths | 5 |
| Total Lines | 23 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | public function convert(SchemaInterface $schema, array $customProperties = []): array |
||
| 29 | { |
||
| 30 | // For CycleORM >= 2.x |
||
| 31 | if (method_exists($schema, 'toArray')) { |
||
| 32 | return $schema->toArray(); |
||
| 33 | } |
||
| 34 | |||
| 35 | $result = []; |
||
| 36 | |||
| 37 | $properties = array_merge($this->constants, $customProperties); |
||
| 38 | |||
| 39 | foreach ($schema->getRoles() as $role) { |
||
| 40 | foreach ($properties as $property) { |
||
| 41 | /** @psalm-suppress ReservedWord */ |
||
| 42 | $value = $schema->define($role, $property); |
||
| 43 | if ($value === null) { |
||
| 44 | continue; |
||
| 45 | } |
||
| 46 | $result[$role][$property] = $value; |
||
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 50 | return $result; |
||
| 51 | } |
||
| 53 |