Gajus\Dora\Input::setAttribute PHP Method

setAttribute() private method

There is no value escaping either. It is assumed that pre-caution steps (e.g. FILTER_SANITIZE_SPECIAL_CHARS) are already taken.
private setAttribute ( string $name, string $value )
$name string
$value string
    private function setAttribute($name, $value)
    {
        // Not possible when setAttribute is private.
        #if (!is_string($name)) {
        #    throw new \InvalidArgumentException('Attribute name is not a string.');
        #} else
        if (!is_string($value) && !is_int($value)) {
            throw new Exception\InvalidArgumentException('Attribute value is not a string.');
        } else {
            if ($name === 'name') {
                throw new Exception\InvalidArgumentException('"name" attribute cannot be overwritten.');
            }
        }
        $this->attributes[$name] = $value;
    }