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;
    }
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;
    }
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 ; }
Set an attribute on the element.

@param string $name The attribute name
@param string $value The attribute value

@return \DiDom\Element
Set an attribute on the element .