Cycles through given attributes and sets them for the element.

@param array $attributes - The elements given options (attributes)

@return string
160453
protected function attributes($attributes = [])
    {
        $ar = [];

        foreach ($attributes as $key => $value) {
            $element = $this->attribute($key, $value);
            if (!is_null($element)) {
                $ar[] = $element;
            }
        }

        return count($ar) > 0 ? ' '.implode(' ', $ar) : '';
    }
100568
public static function attrsToHtml(array $attributes)
    {
        $attrs = [];

        foreach ($attributes as $key => $value) {
            $element = is_numeric($key) ?
                (string)$value :
                (is_null($value) ? (string)$key : $key . '="' . e($value) . '"');
            if (!empty($element)) {
                $attrs[] = $element;
            }
        }

        return count($attrs) ? ' ' . implode(' ', $attrs) : '';
    }
1092179
public function attributes($attributes)
    {
        if (is_array($this->attributes) and is_array($attributes)) {
            $attributes = array_merge($this->attributes, $attributes);
        }
        $this->attributes = $attributes;

        return $this;
    }
213987
public function formatAttributes(array $attributes) {
        foreach ($attributes as $key => $attr) {
            if ($attr instanceof Closure) {
                $attributes[$key] = call_user_func($attr, $this);

            } else if ($this->hasKeyword($attr)) {
                $attributes[$key] = $this->getKeyword($attr);

            } else if ($attr === true) {
                $attributes[$key] = $this->getKeyword($key);

            } else {
                $attributes[$key] = (string) $attr;
            }
        }

        return $attributes;
    }
1352513
public function setAttributes(array $attributes)
    {
        $this->attributes = [];
        foreach ($attributes as $attribute => $value) {
            $this->addAttribute($attribute, $value);
        }

        return $this;
    }
1080337
public function set($attributes = array())
    {
        $this->attributes = array_replace_recursive($this->attributes, $attributes);

        return $this->attributes;
    }
1096913
public function createElement(array $attributes)
    {
        $element = $this->ownerDocument->createElement($this->element);

        $name = null;
        foreach ($attributes as $key => $value) {
            $element->setAttribute($key, $value);
        }

        $this[] = $element;

        return $element;
    }
812301
private function putAttributes($attributes)
	{
		$output = '';

		foreach($attributes as $attribute => $value)
		{
			$output.= ' '.$attribute. '="'.$value.'"';
		}

		return $output;
	}
937207
public static function attributes(array $attributes = null) {
        $attributes = (array)$attributes;
        $output = '';
        foreach ($attributes as $name => $value) {
            $output .= self::attribute($name, $value);
        }
        return $output;
    }
620555
public function setLabelAttributes($attributes)
    {
        if (! is_array($attributes)) {
            $attributes = [$attributes];
        }

        $this->label_attributes = $attributes;

        return $this;
    }
972832
public function setAttributes(Array $attributes) {

		foreach($attributes as $k => $v) {
			$this->setAttribute($k, $v);
		}
		return $this;

	}
115048
protected function generateAttributes(array $attributes)
	{
		if (isset($attributes['style']) && is_array($attributes['style']))
		{
			$attributes['style'] = $this->generateStyle($attributes['style']);
		}

		ksort($attributes);
		$xsl = '';
		foreach ($attributes as $attrName => $attrValue)
		{
			$innerXML = (strpos($attrValue, '<xsl:') !== false) ? $attrValue : AVTHelper::toXSL($attrValue);

			$xsl .= '<xsl:attribute name="' . htmlspecialchars($attrName, ENT_QUOTES, 'UTF-8') . '">' . $innerXML . '</xsl:attribute>';
		}

		return $xsl;
	}
1072925
public function withAttributes(array $attributes = []): Element
    {
        $this->attributes = array_merge(
            $this->attributes,
            $attributes
        );

        return $this;
    }
648802
protected function renderAttributes(array $attributes)
    {
        $attributeString = '';
        foreach ($attributes as $key => $value) {
            if (is_array($value)) {
                $value = implode(' ', $value);
            }
            // Skip attributes that are not to be set (required, disabled, ...).
            if ($value !== false && $value !== '') {
                $attributeString .= ' ' . htmlspecialchars($key, ENT_QUOTES, 'UTF-8');
                // HTML5: do not add a value to boolean attributes.
                // HTML4: add the name of the key as value for the attribute.
                if (!$this->html5 && $value === true) {
                    $value = $key;
                }
                if ($value !== true) {
                    $attributeString .= '="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"';
                }
            }
        }
        return $attributeString;
    }
25209
public static function buildAttributes($attributes)
    {
        $options = array();
        foreach ($attributes as $attr => $val) {
            $options[] = "{$attr}=\"{$val}\"";
        }
        return implode(' ', $options);
    }
203766
protected function _arrayToAttributesString(array $attributes) {
		$attributes_string = '';
		foreach ($attributes as $key => $value) {
			$attributes_string .= ' ' . $key . '="' . $this->_escape($value) . '"';
		}
		return $attributes_string;
	}
1349675
protected function _attr($attributes = [])
    {
        $attribute = '';

        if( is_array($attributes) )
        {
            foreach( $attributes as $key => $values )
            {
                if( is_numeric($key) )
                {
                    $key = $values;
                }

                $attribute .= ' '.$key.':'.$values.';';
            }
        }

        return $attribute;
    }