Auth_OpenID_AX_KeyValueMessage::getSingle PHP Méthode

getSingle() public méthode

Get a single value for an attribute. If no value was sent for this attribute, use the supplied default. If there is more than one value for this attribute, this method will fail.
public getSingle ( $type_uri, $default = null )
    function getSingle($type_uri, $default = null)
    {
        $values = Auth_OpenID::arrayGet($this->data, $type_uri);
        if (!$values) {
            return $default;
        } else {
            if (count($values) == 1) {
                return $values[0];
            } else {
                return new Auth_OpenID_AX_Error(sprintf('More than one value present for %s', $type_uri));
            }
        }
    }