<commit_before><?php

namespace Spatie\UrlSigner\Support;

class Url
{
    public static function queryParameters(string $url): array
    {
        $baseUrl = Str::after($url, '?');

        parse_str($baseUrl, $queryParameters);

        return $queryParameters;
    }

    public static function addQueryParameters(string $url, array $newQueryParameters): string
    {
        $urlQueryParameters = self::queryParameters($url);

        $allQueryParameters = array_merge($urlQueryParameters, $newQueryParameters);

        $baseUrl = Str::before($url, '?');

        return $baseUrl . '?' . http_build_query($allQueryParameters);
    }

    public static function withoutParameters(string $url, array $unwantedParameterNames = []): string
    {
        $urlQueryParameters = self::queryParameters($url);

        foreach($unwantedParameterNames as $name) {
            if (array_key_exists($name, $urlQueryParameters)) {
                unset($urlQueryParameters[$name]);
            }
        }

        $baseUrl = Str::before($url, '?');

        if (count($urlQueryParameters) === 0) {
            return $baseUrl;
        }

        return $baseUrl . '?' . http_build_query($urlQueryParameters);
    }<commit_msg>Fix styling<commit_after><?php

namespace Spatie\UrlSigner\Support;

class Url
{
    public static function queryParameters(string $url): array
    {
        $baseUrl = Str::after($url, '?');

        parse_str($baseUrl, $queryParameters);

        return $queryParameters;
    }

    public static function addQueryParameters(string $url, array $newQueryParameters): string
    {
        $urlQueryParameters = self::queryParameters($url);

        $allQueryParameters = array_merge($urlQueryParameters, $newQueryParameters);

        $baseUrl = Str::before($url, '?');

        return $baseUrl.'?'.http_build_query($allQueryParameters);
    }

    public static function withoutParameters(string $url, array $unwantedParameterNames = []): string
    {
        $urlQueryParameters = self::queryParameters($url);

        foreach ($unwantedParameterNames as $name) {
            if (array_key_exists($name, $urlQueryParameters)) {
                unset($urlQueryParameters[$name]);
            }
        }

        $baseUrl = Str::before($url, '?');

        if (count($urlQueryParameters) === 0) {
            return $baseUrl;
        }

        return $baseUrl.'?'.http_build_query($urlQueryParameters);
    }
{'fraction_non_alphanumeric': 0.12844792095512556, 'fraction_numerical': 0.0008233841086867024, 'mean_word_length': 2.9384116693679094, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6570270', 'n_tokens_mistral': 681, 'n_tokens_neox': 652, 'n_words': 124}