private function patternMatch($url)
    {
        $url = explode('/', $url);
        $pattern = explode('/', $this->pattern);
        $matches = true;

        if (count($url) > count($pattern)) {
            return false;
        }

        foreach ($pattern as $pkey => $pvalue) {
            if (!isset($url[$pkey])) {
                if (substr($pvalue, 0, 2) === '{?') {
                    // Piece not in URL but is optional
                    continue;
                } else {
                    // Piece not in URL and is required
                    return false;
                }
            }

            if ($pvalue != $url[$pkey] && substr($pvalue, 0, 1) != '{') {
                // Doesn't contain a required part
                return false;
            }
        }

        return $matches;
    }