public function match($requestUri, $requestMethod)
    {
        // remove query string and trailing slash (if one exists) and then add a new trailing slash
        $this->requestUri = rtrim(strtok($requestUri, '?'), '/');

        // set request method
        $this->requestMethod = $requestMethod;

        // start matching routes

        // look for a direct match in the routes table
        if ($this->matchDirect()) {
            // match found, no need to look for more
            return true;
        } elseif ($this->matchCache()) {
            return true;
        } elseif ($this->matchRegex()) {
            return true;
        }

        // could not find a matching route
        throw new NotFound();
    }