SqlParser\TokensList::getNextOfType PHP Méthode

getNextOfType() public méthode

Gets the next token.
public getNextOfType ( integer $type ) : Token
$type integer The type.
Résultat Token
    public function getNextOfType($type)
    {
        for (; $this->idx < $this->count; ++$this->idx) {
            if ($this->tokens[$this->idx]->type === $type) {
                return $this->tokens[$this->idx++];
            }
        }
        return null;
    }

Usage Example

 public function testGetNextOfType()
 {
     $list = new TokensList($this->tokens);
     $this->assertEquals($this->tokens[0], $list->getNextOfType(Token::TYPE_KEYWORD));
     $this->assertEquals($this->tokens[4], $list->getNextOfType(Token::TYPE_KEYWORD));
     $this->assertEquals(null, $list->getNextOfType(Token::TYPE_KEYWORD));
 }
All Usage Examples Of SqlParser\TokensList::getNextOfType