public function pairWith(Tag $tag)
	{
		if ($this->name === $tag->name)
		{
			if ($this->type === self::START_TAG
			 && $tag->type  === self::END_TAG
			 && $tag->pos   >=  $this->pos)
			{
				$this->endTag  = $tag;
				$tag->startTag = $this;

				$this->cascadeInvalidationTo($tag);
			}
			elseif ($this->type === self::END_TAG
			     && $tag->type  === self::START_TAG
			     && $tag->pos   <=  $this->pos)
			{
				$this->startTag = $tag;
				$tag->endTag    = $this;
			}
		}
	}
public function pairWith(Tag $tag)
	{
		if ($this->name === $tag->name)
		{
			if ($this->type === self::START_TAG
			 && $tag->type  === self::END_TAG
			 && $tag->pos   >=  $this->pos)
			{
				$this->endTag  = $tag;
				$tag->startTag = $this;

				$this->cascadeInvalidationTo($tag);
			}
			elseif ($this->type === self::END_TAG
			     && $tag->type  === self::START_TAG
			     && $tag->pos   <=  $this->pos)
			{
				$this->startTag = $tag;
				$tag->endTag    = $this;
			}
		}
	}
public function pairWith ( Tag $ tag ) { if ( $ this -> name === $ tag -> name ) { if ( $ this -> type === self :: START_TAG && $ tag -> type === self :: END_TAG && $ tag -> pos >= $ this -> pos ) { $ this -> endTag = $ tag ; $ tag -> startTag = $ this ; $ this -> cascadeInvalidationTo ( $ tag ) ; } elseif ( $ this -> type === self :: END_TAG && $ tag -> type === self :: START_TAG && $ tag -> pos <= $ this -> pos ) { $ this -> startTag = $ tag ; $ tag -> endTag = $ this ; } } }
Pair this tag with given tag

@param  Tag  $tag
@return void
Pair this tag with given tag