public function readNextBlock($openingDelimiter, $closingDelimiter, $skipDelimiters = true)
	{
		$od = (array)$openingDelimiter;
		$cd = (array)$closingDelimiter;

		$tokens = [];
		$level = -1;

		while($this->valid() && $level < 0)
		{
			$token = $this->current();

			if($token->isOneOf($od))
			{
				$level = 0;

				break;
			}

			$this->next();
		}

		if($level == 0)
		{
			while($this->valid())
			{
				$token = $this->current();

				if($token->isOneOf($od))
				{
					$level++;
				}
				elseif($token->isOneOf($cd))
				{
					$level--;
				}

				$tokens[] = $token;

				if($level == 0)
				{
					$this->next();

					break;
				}

				$this->next();
			}
		}

		if($skipDelimiters)
		{
			return $this->createTokenSequence(array_slice($tokens, 1, count($tokens) - 2));
		}

		return $this->createTokenSequence($tokens);
	}
public function readNextBlock($openingDelimiter, $closingDelimiter, $skipDelimiters = true)
	{
		$od = (array)$openingDelimiter;
		$cd = (array)$closingDelimiter;

		$tokens = [];
		$level = -1;

		while($this->valid() && $level < 0)
		{
			$token = $this->current();

			if($token->isOneOf($od))
			{
				$level = 0;

				break;
			}

			$this->next();
		}

		if($level == 0)
		{
			while($this->valid())
			{
				$token = $this->current();

				if($token->isOneOf($od))
				{
					$level++;
				}
				elseif($token->isOneOf($cd))
				{
					$level--;
				}

				$tokens[] = $token;

				if($level == 0)
				{
					$this->next();

					break;
				}

				$this->next();
			}
		}

		if($skipDelimiters)
		{
			return $this->createTokenSequence(array_slice($tokens, 1, count($tokens) - 2));
		}

		return $this->createTokenSequence($tokens);
	}
public function readNextBlock ( $ openingDelimiter , $ closingDelimiter , $ skipDelimiters = true ) { $ od = ( array ) $ openingDelimiter ; $ cd = ( array ) $ closingDelimiter ; $ tokens = [ ] ; $ level = - 1 ; while ( $ this -> valid ( ) && $ level < 0 ) { $ token = $ this -> current ( ) ; if ( $ token -> isOneOf ( $ od ) ) { $ level = 0 ; break ; } $ this -> next ( ) ; } if ( $ level == 0 ) { while ( $ this -> valid ( ) ) { $ token = $ this -> current ( ) ; if ( $ token -> isOneOf ( $ od ) ) { $ level ++ ; } elseif ( $ token -> isOneOf ( $ cd ) ) { $ level -- ; } $ tokens [ ] = $ token ; if ( $ level == 0 ) { $ this -> next ( ) ; break ; } $ this -> next ( ) ; } } if ( $ skipDelimiters ) { return $ this -> createTokenSequence ( array_slice ( $ tokens , 1 , count ( $ tokens ) - 2 ) ) ; } return $ this -> createTokenSequence ( $ tokens ) ; }
Reads the next code block enclosed in the given delimiters, returns an
empty token sequence when no tokens were matched.

@param mixed $openingDelimiter
@param mixed $closingDelimiter
@param boolean $skipDelimiters Skip enclosing delimiters?
@return AbstractTokenSequence
Reads the next code block enclosed in the given delimiters returns an empty token sequence when no tokens were matched .