for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PHPAlgorithms\GraphTools\Traits;
trait toArray {
public function toArray()
{
$properties = array();
foreach ((new \ReflectionClass($this))->getProperties() as $reflectionProperty) {
$properties[$reflectionProperty->getName()] = $this->{$reflectionProperty->getName()};
}
return $properties;