| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | public function toArray(): array |
||
| 19 | { |
||
| 20 | $obj = new ReflectionClass(static::class); |
||
| 21 | |||
| 22 | $attributes = [ |
||
| 23 | 'type' => $this->getType() |
||
| 24 | ]; |
||
| 25 | |||
| 26 | foreach ($obj->getProperties(ReflectionProperty::IS_PUBLIC) as $reflectionProperty) { |
||
| 27 | $name = $reflectionProperty->getName(); |
||
| 28 | $value = $this->$name ?? null; |
||
| 29 | |||
| 30 | if (is_null($value)) { |
||
| 31 | continue; |
||
| 32 | } |
||
| 33 | |||
| 34 | $attributes[$name] = $value; |
||
| 35 | } |
||
| 36 | |||
| 37 | return $attributes; |
||
| 38 | } |
||
| 40 |