protected function matchTokens(array $pathTokens, array $patternTokens)
    {
        $matches = [];
        for ($i = 1; $i < count($patternTokens); $i++) {
            $pathToken = $pathTokens[$i];
            $patternToken = $patternTokens[$i];
            if ($pathToken == '' && $patternToken != '') {
                return false;
            }
            if ($patternToken == '*') {
                continue;
            }
            if (substr($patternToken, 0, 1) == '{') {
                $matches[substr($patternToken, 1, -1)] = urldecode($pathToken);
            } else if (urldecode($pathToken) != $patternToken) {
                return false;
            }
        }
        if (empty($matches)) {
            return true;
        }
        return $matches;
    }
protected function matchTokens(array $pathTokens, array $patternTokens)
    {
        $matches = [];
        for ($i = 1; $i < count($patternTokens); $i++) {
            $pathToken = $pathTokens[$i];
            $patternToken = $patternTokens[$i];
            if ($pathToken == '' && $patternToken != '') {
                return false;
            }
            if ($patternToken == '*') {
                continue;
            }
            if (substr($patternToken, 0, 1) == '{') {
                $matches[substr($patternToken, 1, -1)] = urldecode($pathToken);
            } else if (urldecode($pathToken) != $patternToken) {
                return false;
            }
        }
        if (empty($matches)) {
            return true;
        }
        return $matches;
    }
protected function matchTokens ( array $ pathTokens , array $ patternTokens ) { $ matches = [ ] ; for ( $ i = 1 ; $ i < count ( $ patternTokens ) ; $ i ++ ) { $ pathToken = $ pathTokens [ $ i ] ; $ patternToken = $ patternTokens [ $ i ] ; if ( $ pathToken == '' && $ patternToken != '' ) { return false ; } if ( $ patternToken == '*' ) { continue ; } if ( substr ( $ patternToken , 0 , 1 ) == '{' ) { $ matches [ substr ( $ patternToken , 1 , - 1 ) ] = urldecode ( $ pathToken ) ; } else if ( urldecode ( $ pathToken ) != $ patternToken ) { return false ; } } if ( empty ( $ matches ) ) { return true ; } return $ matches ; }
Compare path tokens side by side. Returns false if no match, true if match without capture,
and array with matched tokens if used with capturing pattern

@param string[] $pathTokens
@param string[] $patternTokens

@return array<string,string>|bool
Compare path tokens side by side . Returns false if no match true if match without capture and array with matched tokens if used with capturing pattern