Auth_OpenID_SRegRequest::requestField PHP Method

requestField() public method

$field_name: the unqualified simple registration field name required: whether the given field should be presented to the user as being a required to successfully complete the request strict: whether to raise an exception when a field is added to a request more than once
public requestField ( $field_name, $required = false, $strict = false )
    function requestField($field_name, $required = false, $strict = false)
    {
        if (!Auth_OpenID_checkFieldName($field_name)) {
            return false;
        }
        if ($strict) {
            if ($this->contains($field_name)) {
                return false;
            }
        } else {
            if (in_array($field_name, $this->required)) {
                return true;
            }
            if (in_array($field_name, $this->optional)) {
                if ($required) {
                    unset($this->optional[array_search($field_name, $this->optional)]);
                } else {
                    return true;
                }
            }
        }
        if ($required) {
            $this->required[] = $field_name;
        } else {
            $this->optional[] = $field_name;
        }
        return true;
    }