protected function addAttribute(Tag $tag, $attrName)
	{
		$isUrl = false;
		$exprs = [];
		foreach ($this->captures as $key => $capture)
		{
			if ($capture['name'] !== $attrName)
			{
				continue;
			}
			$exprs[] = $capture['expr'];
			if (isset($this->references['asUrl'][$key]))
			{
				$isUrl = true;
			}
		}
		$exprs = array_unique($exprs);

		$regexp = $this->delimiter . '^';
		$regexp .= (count($exprs) === 1) ? $exprs[0] : '(?:' . implode('|', $exprs) . ')';
		$regexp .= '$' . $this->delimiter . 'D' . $this->modifiers;

		$attribute = $tag->attributes->add($attrName);

		$filter = $this->configurator->attributeFilters['#regexp'];
		$filter->setRegexp($regexp);
		$attribute->filterChain[] = $filter;

		if ($isUrl)
		{
			$filter = $this->configurator->attributeFilters['#url'];
			$attribute->filterChain[] = $filter;
		}
	}
protected function addAttribute(Tag $tag, $attrName)
	{
		$isUrl = false;
		$exprs = [];
		foreach ($this->captures as $key => $capture)
		{
			if ($capture['name'] !== $attrName)
			{
				continue;
			}
			$exprs[] = $capture['expr'];
			if (isset($this->references['asUrl'][$key]))
			{
				$isUrl = true;
			}
		}
		$exprs = array_unique($exprs);

		$regexp = $this->delimiter . '^';
		$regexp .= (count($exprs) === 1) ? $exprs[0] : '(?:' . implode('|', $exprs) . ')';
		$regexp .= '$' . $this->delimiter . 'D' . $this->modifiers;

		$attribute = $tag->attributes->add($attrName);

		$filter = $this->configurator->attributeFilters['#regexp'];
		$filter->setRegexp($regexp);
		$attribute->filterChain[] = $filter;

		if ($isUrl)
		{
			$filter = $this->configurator->attributeFilters['#url'];
			$attribute->filterChain[] = $filter;
		}
	}
protected function addAttribute ( Tag $ tag , $ attrName ) { $ isUrl = false ; $ exprs = [ ] ; foreach ( $ this -> captures as $ key => $ capture ) { if ( $ capture [ 'name' ] !== $ attrName ) { continue ; } $ exprs [ ] = $ capture [ 'expr' ] ; if ( isset ( $ this -> references [ 'asUrl' ] [ $ key ] ) ) { $ isUrl = true ; } } $ exprs = array_unique ( $ exprs ) ; $ regexp = $ this -> delimiter . '^' ; $ regexp .= ( count ( $ exprs ) === 1 ) ? $ exprs [ 0 ] : '(?:' . implode ( '|' , $ exprs ) . ')' ; $ regexp .= '$' . $ this -> delimiter . 'D' . $ this -> modifiers ; $ attribute = $ tag -> attributes -> add ( $ attrName ) ; $ filter = $ this -> configurator -> attributeFilters [ '#regexp' ] ; $ filter -> setRegexp ( $ regexp ) ; $ attribute -> filterChain [ ] = $ filter ; if ( $ isUrl ) { $ filter = $ this -> configurator -> attributeFilters [ '#url' ] ; $ attribute -> filterChain [ ] = $ filter ; } }
Add given attribute to given tag based on parsed captures

@param  Tag    $tag
@param  string $attrName
@return void
Add given attribute to given tag based on parsed captures