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;
    }