| @@ 41-52 (lines=12) @@ | ||
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| 41 | public function all(): array |
|
| 42 | { |
|
| 43 | $class = new ReflectionClass(static::class); |
|
| 44 | ||
| 45 | $values = []; |
|
| 46 | ||
| 47 | foreach ($class->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { |
|
| 48 | $values[$property->getName()] = $property->getValue($this); |
|
| 49 | } |
|
| 50 | ||
| 51 | return $values; |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @param string ...$keys |
|
| @@ 102-111 (lines=10) @@ | ||
| 99 | * |
|
| 100 | * @return array|\Spatie\ValueObject\Property[] |
|
| 101 | */ |
|
| 102 | private function getPublicProperties(ReflectionClass $class): array |
|
| 103 | { |
|
| 104 | $properties = []; |
|
| 105 | ||
| 106 | foreach ($class->getProperties(ReflectionProperty::IS_PUBLIC) as $reflectionProperty) { |
|
| 107 | $properties[$reflectionProperty->getName()] = Property::fromReflection($this, $reflectionProperty); |
|
| 108 | } |
|
| 109 | ||
| 110 | return $properties; |
|
| 111 | } |
|
| 112 | } |
|
| 113 | ||