This parses $key => $value attributes into a HTML $key="$value"
string.

@return string HTML attributes.
@ignore
969467
private function createAttributes()
        {
            $return = [];
            foreach ($this->attributes as $key => $value) {
                if ('data' === $key && is_array($value)) {
                    foreach ($value as $k => $v) {
                        $return[] = 'data-'.$k.'="'.htmlentities(is_array($v)
                                ? implode(' ', $v)
                                : $v, ENT_QUOTES, 'UTF-8', false).'"';
                    }
                } else {
                    $return[] = $key.'="'.htmlentities(is_array($value)
                            ? implode(' ', $value)
                            : $value, ENT_QUOTES, 'UTF-8', false).'"';
                }
            }
            return count($return)
                ? ' '.implode(' ', $return)
                : false;
        }
625704
public function setAttribute($key, $value = null)
    {
        if(is_array($key))
        {
            foreach($key as $item => $value) {
                if(strrpos($item, '[]') == ($itemLength = strlen($item) - 2)) {
                    $this->attributes[substr($item, 0, $itemLength)][] = $value;
                } else {
                    $this->attributes[$item] = $value;
                }
            }
        }
        else
        {
            if(strrpos($key, '[]') == ($keyLength = strlen($key) - 2)) {
                $this->attributes[substr($key, 0, $keyLength)][] = $value;
            } else {
                $this->attributes[$key] = $value;
            }
        }

        return $this;
    }
788014
public function attributes()
	{
		if (!is_array($this->attrs)) {
			return '';
		}

		$s = '';
		$attrs = $this->attrs;

		foreach ($attrs as $key => $value) {
			if ($value === NULL || $value === FALSE) {
				continue;

			} elseif ($value === TRUE) {
				if (static::$xhtml) {
					$s .= ' ' . $key . '="' . $key . '"';
				} else {
					$s .= ' ' . $key;
				}
				continue;

			} elseif (is_array($value)) {
				if (strncmp($key, 'data-', 5) === 0) {
					$value = json_encode($value);

				} else {
					$tmp = NULL;
					foreach ($value as $k => $v) {
						if ($v != NULL) { // intentionally ==, skip NULLs & empty string
							//  composite 'style' vs. 'others'
							$tmp[] = $v === TRUE ? $k : (is_string($k) ? $k . ':' . $v : $v);
						}
					}
					if ($tmp === NULL) {
						continue;
					}

					$value = implode($key === 'style' || !strncmp($key, 'on', 2) ? ';' : ' ', $tmp);
				}

			} elseif (is_float($value)) {
				$value = rtrim(rtrim(number_format($value, 10, '.', ''), '0'), '.');

			} else {
				$value = (string)$value;
			}

			$q = strpos($value, '"') === FALSE ? '"' : "'";
			$s .= ' ' . $key . '=' . $q
				. str_replace(
					['&', $q, '<'],
					['&amp;', $q === '"' ? '&quot;' : '&#39;', self::$xhtml ? '&lt;' : '<'],
					$value
				)
				. (strpos($value, '`') !== FALSE && strpbrk($value, ' <>"\'') === FALSE ? ' ' : '')
				. $q;
		}

		$s = str_replace('@', '&#64;', $s);

		return $s;
	}
40062
protected function attribute($key, $value)
    {
        if (is_numeric($key)) {
            $key = $value;
        }

        if (!is_null($value)) {
            return $key.'="'.$value.'"';
        }
    }
78237
protected function parseAttributeValue()
	{
		// Test whether the value is in quotes
		if ($this->text[$this->pos] === '"' || $this->text[$this->pos] === "'")
		{
			return $this->parseQuotedAttributeValue();
		}

		// Capture everything up to whichever comes first:
		//  - an endline
		//  - whitespace followed by a slash and a closing bracket
		//  - a closing bracket, optionally preceded by whitespace
		//  - whitespace followed by another attribute (name followed by equal sign)
		//
		// NOTE: this is for compatibility with some forums (such as vBulletin it seems)
		//       that do not put attribute values in quotes, e.g.
		//       [quote=John Smith;123456] (quoting "John Smith" from post #123456)
		if (!preg_match('#[^\\]\\n]*?(?=\\s*(?:\\s/)?\\]|\\s+[-\\w]+=)#', $this->text, $m, null, $this->pos))
		{
			throw new RuntimeException;
		}

		$attrValue  = $m[0];
		$this->pos += strlen($attrValue);

		return $attrValue;
	}
478614
static public function attributes($attributes)
    {
        $compiled = '';
        foreach($attributes as $key => $value) {
            if ($value === NULL) {
                // Skip attributes that have NULL values
                continue;
            }
            if (is_numeric($key)) {
                // Assume non-associative keys are mirrored attributes
                $key = $value;
            }
            // Add the attribute value
            $compiled .= ' '.$key.'="' . htmlspecialchars( (string) $value, ENT_QUOTES, self::$charset, true) . '"';
        }
        return $compiled;
    }
1016887
public function renderOpen()
    {
        $html = "<$this->tagName";

        if ($this->attributes) {
            $parsedAttrs = [];
            foreach ($this->attributes as $key => $value) {
                switch (true) {
                    case is_string($value):
                    case is_int($value):
                    case is_float($value):
                        $parsedAttrs[] = "$key=\"$value\"";
                        break;
                    case $value === null:
                        $parsedAttrs[] = $key;
                        break;
                }
            }
            $html .= ' '.implode($parsedAttrs, ' ');
        }

        if ($this->isSelfClosing) {
            return "$html />";
        }

        $html .= '>';

        return $html;
    }
641591
protected function attributeElement($key, $value)
    {
        if (is_numeric($key)) $key = $value;

        if(is_bool($value))
            return $key;

        if ( ! is_null($value))
            return $key.'="'.htmlentities($value, ENT_QUOTES, 'UTF-8', false).'"';

        return null;
    }
215077
protected function wrapValue($value)
    {
        if ($value === '*') {
            return $value;
        }

        // If the given value is a JSON selector we will wrap it differently than a
        // traditional value. We will need to split this path and wrap each part
        // wrapped, etc. Otherwise, we will simply wrap the value as a string.
        if ($this->isJsonSelector($value)) {
            return $this->wrapJsonSelector($value);
        }

        return '`' . str_replace('`', '``', $value) . '`';
    }
623568
public function getAttribute(string $key)
    {
        $attribute = $this->tag->getAttribute($key);
        if ( ! is_null($attribute)) {
            $attribute = $attribute['value'];
        }

        return $attribute;
    }
1154120
protected function getAttributesString()
    {
        $result = '';
        ksort($this->props);
        foreach ($this->props as $k => $v) {
            if (substr($k, 0, 1) !== '_') {
                if ($v === true) {
                    $result .= $k . ' ';
                } else {
                    $result .= $k . '="' . $this->escapeAttr($v) . '" ';
                }
            }
        }
        if ($result) {
            $result = ' ' . trim($result);
        }

        return $result;
    }
400668
public static function get_attribute_html( $attributes = array() ) {
		$html = '';

		if ( ! $attributes ) {
			return $html;
		}

		foreach ( $attributes as $key => $attribute ) {
			$html .= ' ' . esc_attr( $key ) . '="' . esc_attr( $attribute ) . '"';
		}

		return $html;
	}
889551
final public function parseAttributes() {
        $return = '';
        if (!$this->attributes)
            $this->attributes = new Object();
        foreach ($this->attributes->toArray() as $attr => $val) {
            $return .= \Util::camelToHyphen($attr) . '="' . $val . '" ';
        }
        return $return;
    }
316720
private function parse_attributes($attr)
    {
        $html = '';

        if (!empty($attr)) {
            $html = '';

            foreach ($attr as $key => $value) {
                $html .= \sprintf('%s="%s" ', $key, \esc_attr($value));
            }
        }

        return \trim($html);
    }
773627
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 numerics.
        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 . '="' . e($value, false) . '"';
        }
    }
1315825
protected function parseValue($value, $key = null)
    {
        $value = trim($value);
        $type = '\Minime\\Annotations\\Types\\DynamicType';
        if (preg_match($this->typesPattern, $value, $found)) { // strong typed
            $type = $found[1];
            $value = trim(substr($value, strlen($type)));
            if (in_array($type, $this->types)) {
                $type = array_search($type, $this->types);
            }
        }

        return (new $type)->parse($value, $key);
    }
262712
public function parse($value, $sub)
    {
        $label = $sub ?: $value;

        // if obfuscation is enabled generate tag string due to yii tag method will encode attributes.
        if ($this->obfuscate) {
            if (!$sub) {
                $label = $this->obfuscate($label);
            }
            return '<a href="'.$this->obfuscate("mailto:{$value}").'" rel="nofollow">'.$label.'</a>';
        }

        return Html::mailto($label, $value, [
            'rel' => 'nofollow',
        ]);
    }