protected function getMagicStartCoords($tagPos)
	{
		if (empty($this->tagStack))
		{
			// Set the next position outside the text boundaries
			$nextPos  = $this->textLen + 1;
			$nextPrio = 0;
		}
		else
		{
			$nextTag  = end($this->tagStack);
			$nextPos  = $nextTag->getPos();
			$nextPrio = $nextTag->getSortPriority();
		}

		// Find the first non-whitespace position before next tag or the end of text
		while ($tagPos < $nextPos && strpos(self::WHITESPACE, $this->text[$tagPos]) !== false)
		{
			++$tagPos;
		}

		// Set a priority that ensures this tag appears before the next tag
		$prio = ($tagPos === $nextPos) ? $nextPrio - 1 : 0;

		return [$tagPos, $prio];
	}
protected function getMagicStartCoords($tagPos)
	{
		if (empty($this->tagStack))
		{
			// Set the next position outside the text boundaries
			$nextPos  = $this->textLen + 1;
			$nextPrio = 0;
		}
		else
		{
			$nextTag  = end($this->tagStack);
			$nextPos  = $nextTag->getPos();
			$nextPrio = $nextTag->getSortPriority();
		}

		// Find the first non-whitespace position before next tag or the end of text
		while ($tagPos < $nextPos && strpos(self::WHITESPACE, $this->text[$tagPos]) !== false)
		{
			++$tagPos;
		}

		// Set a priority that ensures this tag appears before the next tag
		$prio = ($tagPos === $nextPos) ? $nextPrio - 1 : 0;

		return [$tagPos, $prio];
	}
protected function getMagicStartCoords ( $ tagPos ) { if ( empty ( $ this -> tagStack ) ) { // Set the next position outside the text boundaries $ nextPos = $ this -> textLen + 1 ; $ nextPrio = 0 ; } else { $ nextTag = end ( $ this -> tagStack ) ; $ nextPos = $ nextTag -> getPos ( ) ; $ nextPrio = $ nextTag -> getSortPriority ( ) ; } // Find the first non-whitespace position before next tag or the end of text while ( $ tagPos < $ nextPos && strpos ( self :: WHITESPACE , $ this -> text [ $ tagPos ] ) !== false ) { ++ $ tagPos ; } // Set a priority that ensures this tag appears before the next tag $ prio = ( $ tagPos === $ nextPos ) ? $ nextPrio - 1 : 0 ; return [ $ tagPos , $ prio ] ; }
Compute the position and priority of a magic start tag, adjusted for whitespace

@param  integer   $tagPos Leftmost possible position for the tag
@return integer[]         [Tag pos, priority]
Compute the position and priority of a magic start tag adjusted for whitespace