src/HtmlElementAbstract.php
public function setAttribute($key, $value = null)
    {
        if (is_null($value)) {
            $this->getAttributeMap()->remove($key);
        } else {
            $this->getAttributeMap()->set($key, $value);
        }
        return $this;
    }
public function setAttribute($key, $value = null)
    {
        if (is_null($value)) {
            $this->getAttributeMap()->remove($key);
        } else {
            $this->getAttributeMap()->set($key, $value);
        }
        return $this;
    }
set attribute to html element

@param       string      $key        html element attribute key
@param       string      $value      html element attribute value
@return      HtmlElementAbstract