<commit_before><?php

namespace Kelunik\AcmeClient;

use Webmozart\Assert\Assert;

function suggestCommand($badCommand, array $commands, $suggestThreshold = 70) {
    Assert::string($badCommand, "Bad command must be a string. Got: %s");
    Assert::integer($suggestThreshold, "Suggest threshold must be an integer. Got: %s");

    $badCommand = strtolower($badCommand);

    $bestMatch = "";
    $bestMatchPercentage = 0;
    $byRefPercentage = 0;

    foreach ($commands as $command) {
        \similar_text($badCommand, strtolower($command), $byRefPercentage);

        if ($byRefPercentage > $bestMatchPercentage) {
            $bestMatchPercentage = $byRefPercentage;
            $bestMatch = $command;
        }
    }

    return $bestMatchPercentage >= $suggestThreshold ? $bestMatch : "";
}

function resolveServer($uri) {
    Assert::string($uri, "URI must be a string. Got: %s");

    $shortcuts = [
        "letsencrypt" => "https://acme-v01.api.letsencrypt.org/directory",
        "letsencrypt:production" => "https://acme-v01.api.letsencrypt.org/directory",
        "letsencrypt:staging" => "https://acme-staging.api.letsencrypt.org/directory",
    ];

    if (isset($shortcuts[$uri])) {
        return $shortcuts[$uri];
    }

    $protocol = substr($uri, 0, strpos($uri, "://"));

    if (!$protocol || $protocol === $uri) {
        return "https://{$uri}";
    } else {
        return $uri;
    }
}

function serverToKeyname($server) {
    $server = substr($server, strpos("://", $server) + 3);

    $keyFile = str_replace("/", ".", $server);<commit_msg>Fix parameter order for strpos<commit_after><?php

namespace Kelunik\AcmeClient;

use Webmozart\Assert\Assert;

function suggestCommand($badCommand, array $commands, $suggestThreshold = 70) {
    Assert::string($badCommand, "Bad command must be a string. Got: %s");
    Assert::integer($suggestThreshold, "Suggest threshold must be an integer. Got: %s");

    $badCommand = strtolower($badCommand);

    $bestMatch = "";
    $bestMatchPercentage = 0;
    $byRefPercentage = 0;

    foreach ($commands as $command) {
        \similar_text($badCommand, strtolower($command), $byRefPercentage);

        if ($byRefPercentage > $bestMatchPercentage) {
            $bestMatchPercentage = $byRefPercentage;
            $bestMatch = $command;
        }
    }

    return $bestMatchPercentage >= $suggestThreshold ? $bestMatch : "";
}

function resolveServer($uri) {
    Assert::string($uri, "URI must be a string. Got: %s");

    $shortcuts = [
        "letsencrypt" => "https://acme-v01.api.letsencrypt.org/directory",
        "letsencrypt:production" => "https://acme-v01.api.letsencrypt.org/directory",
        "letsencrypt:staging" => "https://acme-staging.api.letsencrypt.org/directory",
    ];

    if (isset($shortcuts[$uri])) {
        return $shortcuts[$uri];
    }

    $protocol = substr($uri, 0, strpos($uri, "://"));

    if (!$protocol || $protocol === $uri) {
        return "https://{$uri}";
    } else {
        return $uri;
    }
}

function serverToKeyname($server) {
    $server = substr($server, strpos($server, "://") + 3);

    $keyFile = str_replace("/", ".", $server);
{'fraction_non_alphanumeric': 0.16798732171156894, 'fraction_numerical': 0.006339144215530904, 'mean_word_length': 3.282225237449118, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 8, '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': '1308983', 'n_tokens_mistral': 1030, 'n_tokens_neox': 985, 'n_words': 198}