public function match($mixed)
    {
        if (! ($mixed instanceof Request) && ! is_string($mixed)) {
            throw new \InvalidArgumentException(sprintf(
                "Invalid Argument Error: Invalid type param, it can be a url string or a Request object, '%s' given.",
                gettype($mixed)
            ));
        }

        if ($this->sortRoutesEnabled) {
            $this->sortRoutes();
        }

        foreach ($this->routes as $name => $route) {
            if (($params = $route->match($mixed)) !== false) {
                return $params;
            }
        }

        $url = is_string($mixed) ? $mixed : $mixed->getPathInfo();
        throw new Exception\ResourceNotFoundException($url);
    }