private static function toArrayRecursive($object)
    {
        $output = get_object_vars($object);

        foreach ($output as $key => $value) {
            if ($value instanceof \DateTime) {
                $output[$key] = $value->format('c');
            } elseif (is_object($value)) {
                $output[$key] = static::toArrayRecursive($value);
            }
        }

        return $output;
    }
private static function toArrayRecursive($object)
    {
        $output = get_object_vars($object);

        foreach ($output as $key => $value) {
            if ($value instanceof \DateTime) {
                $output[$key] = $value->format('c');
            } elseif (is_object($value)) {
                $output[$key] = static::toArrayRecursive($value);
            }
        }

        return $output;
    }
private static function toArrayRecursive ( $ object ) { $ output = get_object_vars ( $ object ) ; foreach ( $ output as $ key => $ value ) { if ( $ value instanceof \ DateTime ) { $ output [ $ key ] = $ value -> format ( 'c' ) ; } elseif ( is_object ( $ value ) ) { $ output [ $ key ] = static :: toArrayRecursive ( $ value ) ; } } return $ output ; }
Recursively cast an object into an array.
@param mixed $object
@return mixed[]
Recursively cast an object into an array .