public static function addNonce($url, $action, $nonceParamName = 'nonce')
    {
        $fake = $url && strpos($url, '/') === 0;

        if ($fake) {
            $url = 'http://domain.com' . $url;
        }
        $uri = new static($url);
        $parts = $uri->toArray();
        $nonce = Utils::getNonce($action);
        $parts['params'] = ($parts['params'] ?? []) + [$nonceParamName => $nonce];

        if ($fake) {
            unset($parts['scheme'], $parts['host']);
        }

        return static::buildUrl($parts);
    }