Conditions | 1 |
Paths | 1 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function toArray(): array |
||
17 | { |
||
18 | $class = new ReflectionClass($this); |
||
19 | |||
20 | $publicProperties = collect($class->getProperties(ReflectionProperty::IS_PUBLIC)) |
||
21 | ->reject(function (ReflectionProperty $property) { |
||
22 | return $this->shouldIgnore($property->getName()); |
||
23 | }) |
||
24 | ->mapWithKeys(function (ReflectionProperty $property) { |
||
25 | return [$property->getName() => $this->{$property->getName()}]; |
||
26 | }); |
||
27 | |||
28 | $publicMethods = collect($class->getMethods(ReflectionMethod::IS_PUBLIC)) |
||
29 | ->reject(function (ReflectionMethod $method) { |
||
30 | return $this->shouldIgnore($method->getName()); |
||
31 | }) |
||
32 | ->mapWithKeys(function (ReflectionMethod $method) { |
||
33 | return [$method->getName() => $this->createVariableFromMethod($method)]; |
||
34 | }); |
||
35 | |||
36 | return $publicProperties->merge($publicMethods)->all(); |
||
37 | } |
||
38 | |||
66 |