framework/db/SqlToken.php
public function matches(SqlToken $patternToken, $offset = 0, &$firstMatchIndex = null, &$lastMatchIndex = null)
    {
        if (!$patternToken->getHasChildren()) {
            return false;
        }

        $patternToken = $patternToken[0];
        return $this->tokensMatch($patternToken, $this, $offset, $firstMatchIndex, $lastMatchIndex);
    }
public function matches(SqlToken $patternToken, $offset = 0, &$firstMatchIndex = null, &$lastMatchIndex = null)
    {
        if (!$patternToken->getHasChildren()) {
            return false;
        }

        $patternToken = $patternToken[0];
        return $this->tokensMatch($patternToken, $this, $offset, $firstMatchIndex, $lastMatchIndex);
    }
Returns whether this token (including its children) matches the specified "pattern" SQL code.

Usage Example:

```php
$patternToken = (new \yii\db\sqlite\SqlTokenizer('SELECT any FROM any'))->tokenize();
if ($sqlToken->matches($patternToken, 0, $firstMatchIndex, $lastMatchIndex)) {
// ...
}
```

@param SqlToken $patternToken tokenized SQL code to match against. In addition to normal SQL, the
`any` keyword is supported which will match any number of keywords, identifiers, whitespaces.
@param int $offset token children offset to start lookup with.
@param int|null $firstMatchIndex token children offset where a successful match begins.
@param int|null $lastMatchIndex token children offset where a successful match ends.
@return bool whether this token matches the pattern SQL code.