src/Html/HtmlBuilder.php
protected function attributeElement($key, $value)
    {
        // For numeric keys we will assume that the value is a boolean attribute
        // where the presence of the attribute represents a true value and the
        // absence represents a false value.
        // This will convert HTML attributes such as "required" to a correct
        // form instead of using incorrect numeric.
        if (is_numeric($key)) {
            return $value;
        }
        // Treat boolean attributes as HTML properties
        if (is_bool($value) && $key !== 'value') {
            return $value ? $key : '';
        }
        if (! is_null($value)) {
            return $key.'="'.$this->special($value).'"';
        }

        return null;
    }
protected function attributeElement($key, $value)
    {
        // For numeric keys we will assume that the value is a boolean attribute
        // where the presence of the attribute represents a true value and the
        // absence represents a false value.
        // This will convert HTML attributes such as "required" to a correct
        // form instead of using incorrect numeric.
        if (is_numeric($key)) {
            return $value;
        }
        // Treat boolean attributes as HTML properties
        if (is_bool($value) && $key !== 'value') {
            return $value ? $key : '';
        }
        if (! is_null($value)) {
            return $key.'="'.$this->special($value).'"';
        }

        return null;
    }
protected function attributeElement ( $ key , $ value ) { // For numeric keys we will assume that the value is a boolean attribute // where the presence of the attribute represents a true value and the // absence represents a false value. // This will convert HTML attributes such as "required" to a correct // form instead of using incorrect numeric. if ( is_numeric ( $ key ) ) { return $ value ; } // Treat boolean attributes as HTML properties if ( is_bool ( $ value ) && $ key !== 'value' ) { return $ value ? $ key : '' ; } if ( ! is_null ( $ value ) ) { return $ key . '="' . $ this -> special ( $ value ) . '"' ; } return null ; }
Build the attribute.

@param string $key
@param string $value

@return string|null
Build the attribute .