@param $figNamespace
@param array $attributes

@throws RequiredAttributeException
483540
public function setAttributes($figNamespace, array $attributes)
    {
        // We don't call the parent version, which does extraneous work of resolving conds and walks etc.,
        // whereas we just need to check existence of class attribute.
        // A feed tag is oblivious to other control directives.

        $this->attributes = $attributes;

        $this->dicFile = $this->getAttribute('file', null);
        $this->dicName = $this->getAttribute('name', null);
        $this->source = $this->getAttribute('source', null);

        unset($this->attributes['file']);
        unset($this->attributes['name']);
        unset($this->attributes['source']);


        if(null === $this->dicFile) {
            throw new RequiredAttributeException($this->getTagName(),
                $this->xmlLineNumber,
                'file');
        }

    }
1018228
protected function takeAttributeFromDOM($attribute)
    {
        switch ($attribute->localName) {
        case 'errorCode':
            $this->_errorCode = $attribute->nodeValue;
            break;
        case 'reason':
            $this->_reason = $attribute->nodeValue;
            break;
        case 'invalidInput':
            $this->_invalidInput = $attribute->nodeValue;
            break;
        default:
            parent::takeAttributeFromDOM($attribute);
        }
    }
151488
protected function parseAttributes($figNamespace, array $attributes)
    {
        // A fig:call attribute on a tag, indicates that all the other attributes
        // are arguments for the macro. They all are considered as expressions,
        // and therefore there is no need to search for adhoc inside.
        if (! $this->figCall) {

            foreach ($attributes as $name => $value) {
                // Process the non-fig attributes only
                if (strpos($name, $figNamespace) === 0) {
                    continue;
                }

                // Search for inline conditional attributes
                if (preg_match('/\|(.+)\|(.+)\|$/', $value, $matches)) {
                    $attributes[$name] = new InlineCondAttr($matches[1], $matches[2]);
                    //Element can no longer be squashed in optimizations, because it carries
                    // an active runtime piece.
                    $this->isDirective = true;
                    continue;
                }

                // Search for adhocs
                if (preg_match_all('/\{([^\{]+)\}/', $value, $matches, PREG_OFFSET_CAPTURE)) {
                    $parts = [];
                    $previousPosition = 0;

                    $nMatches = count($matches[0]);
                    for($i = 0; $i < $nMatches; ++ $i) {
                        $expression = $matches[1][$i][0];
                        $position = $matches[1][$i][1];
                        if ($position > $previousPosition + 1) {
                            // +1 because we exclude the leading {
                            $parts []= substr($value, $previousPosition, $position - 1 - $previousPosition);
                        }
                        $parts []= new AdHoc($expression);
                        // Mark the current tag as being an active cell in the template,
                        // as opposed to a stupid static string with no logic.
                        $this->isDirective = true;

                        // +1 because we contiunue past the trailing }
                        $previousPosition = $position + strlen($expression) + 1;
                    }
                    // And finish with the trailing static part, past the last }
                    if ($previousPosition < strlen($value)) {
                        $parts []= substr($value, $previousPosition);
                    }

                    // At this stage, $parts is an index array of pieces,
                    // each piece is either a scalar string, or an instance of AdHoc.
                    // If there is only one part, let's simplify the array
                    if (count($parts) == 1) {
                        $parts = $parts[0];
                    }

                    // $parts can safely replace the origin value in $attributes,
                    // because the serializing and rendering engine are aware.
                    $attributes[$name] = $parts;
                }

            }
        }

        $this->attributes = $attributes;
    }
769375
protected function ensureRequiredAttributes(array $spec = [])
    {
        if (! isset($spec['attributes'])) {
            throw new MissingAttributeException(
                sprintf('The attribute "attributes" is not defined, but required.')
            );
        }

        $required = ['type', 'name'];
        foreach ($required as $key) {
            if (! isset($spec['attributes'][$key])) {
                throw new MissingAttributeException(
                    sprintf('The attribute "%s" is not defined, but required.', $key)
                );
            }
        }
    }
840895
public function setAttributes($attributes)
    {
        foreach ($attributes as $k => $val) {
            if ($this->isIgnoredAttribute($k)) {
                continue;
            }

            // this is for adding new class name with
            //   +=newClass
            if( is_string($val) && strpos($val ,'+=') !== false ) {

                
                $origValue = $this->getAttributeValue($k);
                if( is_string($origValue) ) {
                    $origValue .= ' ' . substr($val,2);
                } elseif ( is_array($origValue) ) {
                    $origValue[] = substr($val,2);
                } elseif ( is_object($origValue) ) {
                    throw new Exception('Invalid Object for attribute: ' . get_class($origValue) );
                } else {
                    throw new Exception('Unknown attribute value type.');
                }
                $this->setAttributeValue($k,$origValue);
            } else {
                $this->setAttributeValue($k, $val);
            }
        }
    }
1129147
public function tfoot(array $attributes = []): void
    {
        $this->tableArray[] = Tags::tfoot($this->trArray, $attributes);
        $this->trArray = [];
    }
447029
protected function fillAttributes($resource, array $attributes)
    {
        foreach ($attributes as $attribute => $value) {
            $setter = "set" . ucfirst($attribute);

            if (method_exists($resource, $setter)) {
                $resource->$setter($value);
            }
        }
    }
856600
public function fill(array $attributes)
    {
        foreach ($attributes as $key => $value) {
            if (!in_array($key, $this->fillable)) {
                throw new ApplicationException(Lang::get(
                    'cms::lang.cms_object.invalid_property',
                    ['name' => $key]
                ));
            }

            $this->$key = $value;
        }
    }
1241963
public function thead(array $attributes = []): void
    {
        $this->tableArray[] = Tags::thead($this->trArray, $attributes);
        $this->trArray = [];
    }
1107380
protected function checkAttributeFilters(array $attributes)
	{
		foreach ($attributes as $attrConfig)
		{
			if (empty($attrConfig['filterChain']))
			{
				continue;
			}
			foreach ($attrConfig['filterChain'] as $filter)
			{
				if (substr($filter, 0, 1) !== '#' && !in_array($filter, $this->allowedFilters, true))
				{
					throw new RuntimeException("Filter '$filter' is not allowed in media sites");
				}
			}
		}
	}
645026
private function addNamespaceAttributes(ClassMetadata $metadata, \DOMElement $element): void
    {
        foreach ($metadata->xmlNamespaces as $prefix => $uri) {
            $attribute = 'xmlns';
            if ('' !== $prefix) {
                $attribute .= ':' . $prefix;
            } elseif ($element->namespaceURI === $uri) {
                continue;
            }
            $element->setAttributeNS('http://www.w3.org/2000/xmlns/', $attribute, $uri);
        }
    }
482843
private function openTagHandler($xmlParser, $tagName, $attributes) {
		if($this->firstOpening) {
			$this->firstOpening = false;

			//Position the namespace:
			$matches = null;
			foreach($attributes as $attrName => $attrValue) {
				if(preg_match('/figdice/', $attrValue) &&
					 preg_match('/xmlns:(.+)/', $attrName, $matches)) {
					$this->figNamespace = $matches[1] . ':';
					break;
				}
			}

            // Remove the fig xmlns directive from the list of attributes of the opening root tag
            // (as it should not be rendered)
            unset($attributes['xmlns:' . substr($this->figNamespace, 0, strlen($this->figNamespace) - 1)]);

			// Consume optional fig:trans directive
            if (isset($attributes[$this->figNamespace.'trans'])) {
                $this->defaultTransSource = $attributes[$this->figNamespace.'trans'];
                // Remove the attribute from the list of attributes of the opening root tag
                unset($attributes[$this->figNamespace.'trans']);
            }
        }

		$lineNumber = xml_get_current_line_number($xmlParser);


		//
		// Detect special tags
        //
		if($tagName == $this->figNamespace . TagFigAttr::TAGNAME) {
			$newElement = new TagFigAttr($tagName, $lineNumber);
		} else if ($tagName == $this->figNamespace . TagFigCdata::TAGNAME) {
            $newElement = new TagFigCdata($tagName, $lineNumber);
        } else if ($tagName == $this->figNamespace . TagFigDictionary::TAGNAME) {
            $newElement = new TagFigDictionary($tagName, $lineNumber);
        } else if ($tagName == $this->figNamespace . TagFigFeed::TAGNAME) {
		    $newElement = new TagFigFeed($tagName, $lineNumber);
        } else if ($tagName == $this->figNamespace . TagFigInclude::TAGNAME) {
		    $newElement = new TagFigInclude($tagName, $lineNumber);
        } else if ($tagName == $this->figNamespace . TagFigMount::TAGNAME) {
		    $newElement = new TagFigMount($tagName, $lineNumber);
        } else if ($tagName == $this->figNamespace . TagFigParam::TAGNAME) {
		    $newElement = new TagFigParam($tagName, $lineNumber);
        } else if ($tagName == $this->figNamespace . TagFigTrans::TAGNAME) {
		    $newElement = new TagFigTrans($tagName, $lineNumber);
        } else if ($tagName == $this->figNamespace . TagFigVal::TAGNAME) {
		    $newElement = new TagFigVal($tagName, $lineNumber);
        } else {
			$newElement = new ViewElementTag($tagName, $lineNumber, $this->previousCData);
		}

		$this->previousCData = null;

		$newElement->setAttributes($this->figNamespace, $attributes);


		if($this->rootNode) {
            /** @var ViewElementTag $parentElement */
			$parentElement = & $this->stack[count($this->stack)-1];
			$newElement->parent = &$parentElement;

			//Since the new element has a parent, then the parent is not autoclose.
			$newElement->parent->autoclose = false;

			$parentElement->appendChild($newElement);
		} else
		{
			//If there no root node yet, then this new element is actually
			//the root element for the view.
			$this->rootNode = &$newElement;
		}

		$this->stack[] = & $newElement;
	}
824341
public function setAttributes($selector, array $attributes)
    {
        $nodes = $this->get($selector);

        foreach ($nodes as $node) {
            $node->setAttributes($attributes);
        }
    }
987631
public function doSpecific(Context $context)
    {
        if(!isset($this->attributes['name'])) {
            //name is a required attribute for fig:attr.
            throw new RequiredAttributeException($this->name, $this->xmlLineNumber, 'name');
        }
        //flag attribute
        // Usage: <tag><fig:attr name="ng-app" flag="true" />  will render as flag <tag ng-app> at tag level, without a value.
        if(isset($this->attributes['flag']) && $this->evaluate($context, $this->attributes['flag'])) {
            $context->setParentRuntimeAttribute($this->attributes['name'], new Flag());
        } else {
            if ($this->hasAttribute('value')) {
                $value = $this->evaluate($context, $this->attributes['value']);
                if (is_string($value)) {
                    $value = htmlspecialchars($value);
                }
                $context->setParentRuntimeAttribute($this->attributes['name'],  $value);
            } else {
                $value = '';
                /**
                 * @var ViewElement
                 */
                $child = null;
                foreach ($this->children as $child) {
                    $renderChild = $child->render($context);
                    if ($renderChild === false) {
                        throw new \Exception();
                    }
                    $value .= $renderChild;
                }
                //An XML attribute should not span accross several lines.
                $value = trim(preg_replace("#[\n\r\t]+#", ' ', $value));
                $context->setParentRuntimeAttribute($this->attributes['name'], $value);
            }
        }
        // No more rendering of the inner contents. Job is done, move to next sibling by
        // returning (non-null) empty string
        return '';
    }
728601
protected function fillAttributes(array $attributes, $isFromStorage=true)
    {
        if ($isFromStorage) {
            $this->_originalAttributes = $attributes;
        }
        $this->baseFillAttributes($attributes);
        $this->_loadedFromStorage = $isFromStorage;
        return $this;
    }
440492
protected function resolveRouteGroupAttributes($namespace = null, array $attributes = [])
    {
        if (is_array($namespace)) {
            $attributes = $namespace;
            $namespace  = '';
        }
        if (!is_null($namespace)) {
            $attributes['namespace'] = empty($namespace) ? $this->namespace : "{$this->namespace}\\{$namespace}";
        }
        return $attributes;
    }
721461
public function fill(array $attributes = [])
    {
        $filtered = [];

        foreach ($attributes as $name => $value) {

            // This is done by the parent
            if (in_array($name, ['name', 'constraints'])) {
                continue;
            }

            if (isset(static::$propertyMap[static::class][$name]) ||
                isset(static::$aliases[static::class][$name])) {
                $filtered[$name] = $value;
                continue;
            }

            if (!$value instanceof XType) {
                throw new UnsupportedParameterException("The value of $name has to be instanceof XType");
            }

            $this->set($name, $value);
        }

        return parent::fill($filtered);
    }