| Conditions | 5 |
| Paths | 6 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public static function extract($object, $parent = true) |
||
| 21 | { |
||
| 22 | $array = []; |
||
| 23 | |||
| 24 | $class = (new \ReflectionClass($object))->getProperties(); |
||
| 25 | |||
| 26 | if($parent == false) |
||
|
|
|||
| 27 | $class = (new \ReflectionClass($object))->getParentClass()->getProperties(); |
||
| 28 | |||
| 29 | foreach ($class as $property) { |
||
| 30 | $config = new PropertyConfiguration($property, $object); |
||
| 31 | |||
| 32 | if ($config->ignore() || $config->shouldIgnoreIfNull()) |
||
| 33 | continue; |
||
| 34 | |||
| 35 | $name = $config->getAlias(); |
||
| 36 | $data = $config->getValue(); |
||
| 37 | |||
| 38 | $array[$name] = $data; |
||
| 39 | } |
||
| 40 | |||
| 41 | return $array; |
||
| 42 | } |
||
| 43 | } |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.