public function consume($type = NULL)
	{
		if(!$this->valid())
		{
			throw new \OutOfBoundsException('No more tokens available');
		}

		$token = $this->current();
		
		if($type !== NULL && !$token->is($type))
		{
			throw new \UnexpectedValueException(sprintf('Expected token type %s, read "%s" (%d)', $type, $token, $token->getType()));
		}
		
		$this->next();

		return $token;
	}
public function consume($type = NULL)
	{
		if(!$this->valid())
		{
			throw new \OutOfBoundsException('No more tokens available');
		}

		$token = $this->current();
		
		if($type !== NULL && !$token->is($type))
		{
			throw new \UnexpectedValueException(sprintf('Expected token type %s, read "%s" (%d)', $type, $token, $token->getType()));
		}
		
		$this->next();

		return $token;
	}
public function consume ( $ type = NULL ) { if ( ! $ this -> valid ( ) ) { throw new \ OutOfBoundsException ( 'No more tokens available' ) ; } $ token = $ this -> current ( ) ; if ( $ type !== NULL && ! $ token -> is ( $ type ) ) { throw new \ UnexpectedValueException ( sprintf ( 'Expected token type %s, read "%s" (%d)' , $ type , $ token , $ token -> getType ( ) ) ) ; } $ this -> next ( ) ; return $ token ; }
Consume the next token and return it.

@param integer $type The expected token type...
@return AbstractToken

@throws \OutOfBoundsException When there are no more tokens to be consumed.
@throws \UnexpectedValueException When a token is found but does not match the given type.
Consume the next token and return it .