public static function generateUrl($name, array $tokens = [])
    {
        if ($name === null) {
            return;
        }

        if (isset(static::$routes[$name])) {
            $route = static::$routes[$name];
        } else {
            foreach (static::$routes as $r) {
                if ($r->name === $name) {
                    $route = $r;
                }
            }
        }

        if (isset($route)) {
            return $route->generateUrl($tokens);
        } else {
            throw new Exception("No route with name [{$name}]");
        }
    }