protected function compileRoute(Route $route): array
    {
        $regex = '';
        $prefix = '';
        $prio = 0;
        $pre = true;
        
        $wildcard = false;
        
        foreach (\explode('/', $route->pattern) as $level => $entry) {
            if (!$level) {
                continue;
            }
            
            if ($wildcard) {
                throw new \RuntimeException('No additional path segments are allowed after wildcard matcher');
            }
            
            if ($pre) {
                $prefix .= '/';
            } else {
                $regex .= '/';
            }
            
            $prio += 1000;
            
            if (false === \strpos($entry, '{')) {
                if ($pre) {
                    $prefix .= $entry;
                } else {
                    $regex .= \preg_quote($entry, "'");
                }
                
                $prio += 2;
                
                continue;
            }
            
            $pre = false;
            
            $parts = \preg_split("'(\\{[^\\}]+\\})'", $entry, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY);
            $boost = 0;
            
            foreach ($parts as $part) {
                if ($part[0] != '{') {
                    $regex .= \preg_quote($part, "'");
                    $boost += 2;
                    
                    continue;
                }
                
                if (\substr($part, -2) == '*}') {
                    $regex .= '(.+)';
                    $wildcard = true;
                    
                    break;
                }
                
                $regex .= '([^/]+)';
                $boost -= 1;
            }
            
            if ($wildcard) {
                if (\count($parts) !== 1) {
                    throw new \RuntimeException('Wildcard patern must be the only placeholder of the last route level');
                }
                
                $prio -= 500;
            } else {
                $prio += $boost;
            }
        }
        
        return [
            $route,
            $prio,
            '/' . \ltrim($prefix, '/'),
            $regex
        ];
    }