Completed
Push — master ( d791dd...2d8ee5 )
by Ventaquil
02:14
created

toArray::toArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
3
namespace PHPAlgorithms\GraphTools\Traits;
4
5
trait toArray {
6
    public function toArray()
7
    {
8
        $properties = array();
9
10
        foreach ((new \ReflectionClass($this))->getProperties() as $reflectionProperty) {
11
            $properties[$reflectionProperty->getName()] = $this->{$reflectionProperty->getName()};
12
        }
13
14
        return $properties;
15
    }
16
}
17