protected function matchDynamicRoute(string $path, string $method): ? Route
    {
        // The route to return (null by default)
        $route = null;
        // The dynamic routes
        $dynamicRoutes = self::$collection->getDynamicRoutes($method);

        // Attempt to find a match using dynamic routes that are set
        foreach ($dynamicRoutes as $regex => $dynamicRoute) {
            // If the preg match is successful, we've found our route!
            /* @var array $matches */
            if (preg_match($regex, $path, $matches)) {
                $route = $this->getMatchedDynamicRoute($dynamicRoute, $matches, $method);

                break;
            }
        }

        // If the route was found and the method is valid
        if (null !== $route && $this->isValidMethod($route, $method)) {
            // Return the route
            return $route;
        }

        return null;
    }