IXR_Value::calculateType()

In this article

Source

function calculateType()
{
    if ($this->data === true || $this->data === false) {
        return 'boolean';
    }
    if (is_integer($this->data)) {
        return 'int';
    }
    if (is_double($this->data)) {
        return 'double';
    }

    // Deal with IXR object types base64 and date
    if (is_object($this->data) && is_a($this->data, 'IXR_Date')) {
        return 'date';
    }
    if (is_object($this->data) && is_a($this->data, 'IXR_Base64')) {
        return 'base64';
    }

    // If it is a normal PHP object convert it in to a struct
    if (is_object($this->data)) {
        $this->data = get_object_vars($this->data);
        return 'struct';
    }
    if (!is_array($this->data)) {
        return 'string';
    }

    // We have an array - is it an array or a struct?
    if ($this->isStruct($this->data)) {
        return 'struct';
    } else {
        return 'array';
    }
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.