src/Encoder/ObjectEncoder.php
private function getObjectArray($object, $format)
    {
        if ($format === 'array') {
            return (array) $object;
        } elseif ($format === 'vars') {
            return get_object_vars($object);
        }

        $array = [];

        foreach ($object as $key => $value) {
            $array[$key] = $value;
        }

        return $array;
    }
private function getObjectArray($object, $format)
    {
        if ($format === 'array') {
            return (array) $object;
        } elseif ($format === 'vars') {
            return get_object_vars($object);
        }

        $array = [];

        foreach ($object as $key => $value) {
            $array[$key] = $value;
        }

        return $array;
    }
private function getObjectArray ( $ object , $ format ) { if ( $ format === 'array' ) { return ( array ) $ object ; } elseif ( $ format === 'vars' ) { return get_object_vars ( $ object ) ; } $ array = [ ] ; foreach ( $ object as $ key => $ value ) { $ array [ $ key ] = $ value ; } return $ array ; }
Converts the object into array that can be encoded.
@param object $object Object to convert to an array
@param string $format Object conversion format
@return array The object converted into an array
@throws \RuntimeException If object conversion format is invalid
Converts the object into array that can be encoded .