Conditions | 4 |
Paths | 7 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | public function __toArray() |
||
28 | { |
||
29 | $dto = array(); |
||
30 | try { |
||
31 | $reflectionClass = new \ReflectionClass($this); |
||
32 | $properties = $reflectionClass->getProperties(); |
||
33 | if(count($properties) > 0) { |
||
34 | /** @var \ReflectionProperty $property */ |
||
35 | foreach($properties as $property) { |
||
36 | $dto[$property->getName()] = $property->getValue($this); |
||
37 | } |
||
38 | } |
||
39 | } catch(\Exception $e) { |
||
40 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
||
41 | } |
||
42 | return $dto; |
||
43 | } |
||
44 | |||
68 | } |