protected function matchRoute($pathInfo, $method, $id)
    {
        $route = $this->compile($this->routes[$id]);

        // When $route['method'] is not provided, accepts all request methods
        if ($method && $route['method'] && !preg_match('#' . $route['method'] . '#i', $method)) {
            return false;
        }

        // Check if the route matches the path info
        if (!preg_match($route['regex'], $pathInfo, $matches)) {
            return false;
        }

        // Get params in the path info
        $parameters = array();
        foreach ($matches as $key => $parameter) {
            if (is_int($key)) {
                continue;
            }
            $parameters[$key] = $parameter;
        }

        $parameters += $route['defaults'];

        preg_match_all('#<([a-zA-Z0-9_]++)>#', $route['pattern'], $matches);
        foreach ($matches[1] as $key) {
            if (!array_key_exists($key, $parameters)) {
                $parameters[$key] = null;
            }
        }

        return array('_id' => $id) + $parameters;
    }