<commit_before><?php
// @codingStandardsIgnoreFile

/**
 * Sort versions list
 */
require_once __DIR__ . '/../../bin/autoload-init.php';
//use Naneau\SemVer\Sort;

try {
    if (php_sapi_name() != 'cli') {
        throw new Exception('This file can be run in CLI only.');
    }
    if ($_SERVER['argc'] < 2) {
        echo 'error: Invalid argument. Please set version/s as argument/s.';
        exit(1);
    }

    if ($_SERVER['argc'] > 2) {
        $versionsRaw = implode(' ', $_SERVER['argv']);
    } else {
        $versionsRaw = trim($_SERVER['argv'][1]);
    }

    $versions = preg_replace('#\+[^\n]+#', '', $versionsRaw); //Remove meta information after sign "+"
    $versions = explode("\n", $versions);

    $originalVersions = [];
    foreach ($versions as $key => $original) {
        $normal = ltrim($original, 'v');

        $originalVersions[$normal] = $original;

        $versions[$key] = $normal;
    }

    /**
     * Cannot use naneau/semver to to a problem with patches
     * @link https://github.com/naneau/semver/issues/24
     */
//    $versions = call_user_func_array(Sort::class . '::sort', $versions);

    array_walk($originalVersions, 'trim');
    usort($originalVersions, 'version_compare');
    $versions = $originalVersions;

    echo implode(PHP_EOL, $versions);
} catch (Exception $e) {
    echo 'error: ' . $e->getMessage();
    exit(1);<commit_msg>Fixed versions list output.<commit_after><?php
// @codingStandardsIgnoreFile

/**
 * Sort versions list
 */
require_once __DIR__ . '/../../bin/autoload-init.php';
//use Naneau\SemVer\Sort;

try {
    if (php_sapi_name() != 'cli') {
        throw new Exception('This file can be run in CLI only.');
    }
    //remove file from the args
    $serverArgs = (array)$_SERVER['argv'];
    array_shift($serverArgs);

    if (!$serverArgs) {
        echo 'error: No argument/s. Please set version/s as argument/s.';
        exit(1);
    }

    $versionsRaw = implode(' ', $serverArgs);

    $versions = preg_replace('#\+[^\n]+#', '', $versionsRaw); //Remove meta information after sign "+"
    $versions = preg_split("(\n|\s)", $versions);

    $originalVersions = [];
    foreach ($versions as $key => $original) {
        $normal = ltrim($original, 'v');

        $originalVersions[$normal] = $original;

        $versions[$key] = $normal;
    }

    /**
     * Cannot use naneau/semver to to a problem with patches
     * @link https://github.com/naneau/semver/issues/24
     */
//    $versions = call_user_func_array(Sort::class . '::sort', $versions);

    array_walk($originalVersions, 'trim');
    usort($originalVersions, 'version_compare');
    $versions = $originalVersions;

    echo implode(PHP_EOL, $versions);
} catch (Exception $e) {
    echo 'error: ' . $e->getMessage();
    exit(1);
{'fraction_non_alphanumeric': 0.18005041411595246, 'fraction_numerical': 0.003961109110550955, 'mean_word_length': 2.918194640338505, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 2, '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': '1523142', 'n_tokens_mistral': 906, 'n_tokens_neox': 888, 'n_words': 207}