src/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.
        if (\is_numeric($key)) {
            return $value;
        }

        // Treat boolean attributes as HTML properties
        if (\is_bool($value) && $key !== 'value') {
            return $value ? $key : '';
        }

        if (\is_array($value) && $key === 'class') {
            return 'class="'.\implode(' ', $value).'"';
        }

        if (! \is_null($value)) {
            return $key.'="'.$this->entities($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.
        if (\is_numeric($key)) {
            return $value;
        }

        // Treat boolean attributes as HTML properties
        if (\is_bool($value) && $key !== 'value') {
            return $value ? $key : '';
        }

        if (\is_array($value) && $key === 'class') {
            return 'class="'.\implode(' ', $value).'"';
        }

        if (! \is_null($value)) {
            return $key.'="'.$this->entities($value).'"';
        }

        return null;
    }
Build a single attribute element.

@param  string|int  $key
@param  mixed  $value

@return mixed