@param string $name
@param string $value

@return \DiDom\StyleAttribute

@throws \InvalidArgumentException if property name is not a string
@throws \InvalidArgumentException if property value is not a string
498682
public function setProperty($name, $value)
    {
        if (!is_string($name)) {
            throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($name) ? get_class($name) : gettype($name))));
        }

        if (!is_string($value)) {
            throw new InvalidArgumentException(sprintf('%s expects parameter 2 to be string, %s given', __METHOD__, (is_object($value) ? get_class($value) : gettype($value))));
        }

        $this->parseStyleAttribute();

        $this->properties[$name] = $value;

        $this->updateStyleAttribute();

        return $this;
    }
580732
public function set(string $name, $value)
    {
        if (! array_key_exists($name, $this->map)) {
            throw new \InvalidArgumentException("Setting $name does not exists");
        }
        $this->map[$name] = $value;
    }
381358
public function setAttribute($name, $value){

        $returnValue = false;

        if(is_null($value)){
            return $returnValue;
        }

        if(isset($this->attributes[$name])){

            $datatypeClass = $this->attributes[$name]->getType();
            // check if the attribute needs an element level validation
            if(is_subclass_of($datatypeClass, 'oat\\taoQtiItem\\model\\qti\\datatype\\Identifier')){

                if($value instanceof IdentifiedElement){
                    if($this->validateAttribute($name, $value)){
                        $this->attributes[$name]->setValue($value);
                        $returnValue = true;
                    }else{
                        $vr = print_r($value, true);
                        common_Logger::w($vr);
                        throw new InvalidArgumentException('Invalid identifier attribute value');
                    }
                }elseif(is_string($value)){
                    // try converting to string identifier and search the identified object:
                    $identifier = (string) $value;
                    $elt = $this->getIdentifiedElement($identifier, $datatypeClass::getAllowedClasses());
                    if(!is_null($elt)){
                        // ok, found among allowed classes
                        $this->attributes[$name]->setValue($elt);
                        $returnValue = true;
                    }else{
                        throw new QtiModelException('No QTI element with the identifier has been found: '.$identifier);
                    }
                }
            }else{
                $this->attributes[$name]->setValue($value);
                $returnValue = true;
            }
        }else{
            $this->attributes[$name] = new Generic($value);
            $returnValue = true;
        }

        return $returnValue;
    }
430852
public function attr($name, $value = null)
    {
        $attrs = (array) $this->getAttribute('attribs');

        if ($value === null) {
            return isset($attrs[$name]) ? $attrs[$name] : null;
        }

        $attrs[$name] = $value;

        $this->setAttribute('attribs', $attrs);

        return $this;
    }
134463
public function attr(string $name, $value = null) {
        if (is_null($value)) {
            return $this->getAttr($name);
        } else {
            return $this->setAttr($name, $value);
        }
    }
759626
public function setAttribute($name, $value)
    {
        if (is_numeric($value)) {
            $value = (string) $value;
        }

        if (!is_string($value) && $value !== null) {
            throw new InvalidArgumentException(sprintf('%s expects parameter 2 to be string or null, %s given', __METHOD__, (is_object($value) ? get_class($value) : gettype($value))));
        }

        $this->node->setAttribute($name, $value);

        return $this;
    }
1236813
protected static function formatFieldValue($name, $value) {
		$field	= static::$validator->getField($name);
		if( $field ) {
			$field->getType()->formatValue($field, $value);
		}
		return parent::formatFieldValue($name, $value);
	}
1253091
private static function getHtmlAttribute(string $name, $value): string
    {
        if (!self::isset($value)) {
            return '';
        }

        if ($value === true) {
            return $name;
        }

        if (is_array($value)) {
            $value = self::convertAttributeArrayValue($name, $value);
        }

        return sprintf('%s="%s"', $name, static::escape((string) $value));
    }
199832
public function setAttr(string $name, $value): self {
        $this->collection()->each(function($node) use($name, $value) {
            if ($node instanceof \DOMElement) {
                $node->setAttribute($name, (string)$value);
            }
        });

        return $this;
    }
55636
public final function withAttribute($name, $value): ServerRequestInterface
   {
       $attributes = $this->attributes;
       $attributes[$name] = $value;
       return $this->with("attributes", $attributes);
   }
317393
public function setAttribute(string $name, string $value) : Tag
    {
        $this->attributes[strtolower($name)] = $value;

        return $this;
    }
616715
public function setRequestHeader($name, $value)
    {
        if (!is_string($name))
            throw new \InvalidArgumentException('Argument 1 expected to be string, '.gettype($name).' seen.');

        if (!is_string($value))
            throw new \InvalidArgumentException('Argument 2 expected to be string, '.gettype($value).' seen.');

        if (($name = trim($name)) === '')
            throw new \RuntimeException('Argument 1 cannot be empty string.');

        $this->requestHeaders[$name] = $value;

        return $this;
    }
1248054
public function set_property( $name, $value ) {
		$property = $this->get_property( $name );

		$property->setValue( $value );

		return $property;
	}
956993
public function withAttribute(string $name, $value): self
    {
        return new self(
            $this->decoratedResponse,
            $this->unformattedContent,
            [$name => $value] + $this->attributes
        );
    }
981631
public function setAttribute($name, $value) {
		if ($this->_attributes === null) {
			$this->initAttributes();
		}
		
		$this->_attributes[$name] = $value;
		
		$this->_xml->addAttribute($name, $value);
		
		return $this;
	}
1227392
public function inputFormat($value, $name)
    {
        if (!is_bool($value)) {
            throw new InvalidArgumentException('The value to inputFormat function must be boolean.');
        }
        $value = (int) $value;

        return '000000000000000000000000000000000000000000000000000000000000000' . $value;
    }
1366451
public function setAttributes($name, $value = null) 
	{
		Argument::i()
			->test(1, 'string', 'array')
			->test(2, 'scalar', 'null');
		
		if(is_array($name)) {
			$this->attributes = $name;
			return $this;
		}
		
		$this->attributes[$name] = $value;
		return $this;
	}