| @@ 37-48 (lines=12) @@ | ||
| 34 | } |
|
| 35 | } |
|
| 36 | ||
| 37 | public function all(): array |
|
| 38 | { |
|
| 39 | $class = new ReflectionClass(static::class); |
|
| 40 | ||
| 41 | $values = []; |
|
| 42 | ||
| 43 | foreach ($class->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { |
|
| 44 | $values[$property->getName()] = $property->getValue($this); |
|
| 45 | } |
|
| 46 | ||
| 47 | return $values; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @param string ...$keys |
|
| @@ 92-101 (lines=10) @@ | ||
| 89 | * |
|
| 90 | * @return array|\Spatie\ValueObject\Property[] |
|
| 91 | */ |
|
| 92 | protected function getPublicProperties(ReflectionClass $class): array |
|
| 93 | { |
|
| 94 | $properties = []; |
|
| 95 | ||
| 96 | foreach ($class->getProperties(ReflectionProperty::IS_PUBLIC) as $reflectionProperty) { |
|
| 97 | $properties[$reflectionProperty->getName()] = Property::fromReflection($this, $reflectionProperty); |
|
| 98 | } |
|
| 99 | ||
| 100 | return $properties; |
|
| 101 | } |
|
| 102 | } |
|
| 103 | ||