protected function getTokenPattern(int $type): string
    {
        $patternMap = [
            Token::TYPE_SLASH => '/',
            Token::TYPE_ESCAPED => '~(0|1)',
            Token::TYPE_UNESCAPED => '[^/~]',
            Token::TYPE_ERROR_INVALID_ESCAPE => '~',
        ];
        if (!isset($patternMap[$type])) {
            throw new DomainException("Unknown token type: {$type}");
        }
        $pattern = $patternMap[$type];
        return "#{$pattern}#uA";
    }
protected function getTokenPattern(int $type): string
    {
        $patternMap = [
            Token::TYPE_SLASH => '/',
            Token::TYPE_ESCAPED => '~(0|1)',
            Token::TYPE_UNESCAPED => '[^/~]',
            Token::TYPE_ERROR_INVALID_ESCAPE => '~',
        ];
        if (!isset($patternMap[$type])) {
            throw new DomainException("Unknown token type: {$type}");
        }
        $pattern = $patternMap[$type];
        return "#{$pattern}#uA";
    }
protected function getTokenPattern ( int $ type ) : string { $ patternMap = [ Token :: TYPE_SLASH => '/' , Token :: TYPE_ESCAPED => '~(0|1)' , Token :: TYPE_UNESCAPED => '[^/~]' , Token :: TYPE_ERROR_INVALID_ESCAPE => '~' , ] ; if ( ! isset ( $ patternMap [ $ type ] ) ) { throw new DomainException ( "Unknown token type: {$type}" ) ; } $ pattern = $ patternMap [ $ type ] ; return "#{$pattern}#uA" ; }
Returns anchored regular expression pattern for given token type.

@param int $type
@return string
Returns anchored regular expression pattern for given token type .