<commit_before><?php

use App\Command;

/**
 * Converts a number of seconds into a more human readable format
 *
 * @param int $seconds The number of seconds
 * @return string
 */
function human_readable_duration($seconds)
{
    $units = [
        'week'   => 7 * 24 * 3600,
        'day'    => 24 * 3600,
        'hour'   => 3600,
        'minute' => 60,
        'second' => 1
    ];

    if ($seconds == 0) {
        return '0 seconds';
    }

    $readable = '';
    foreach ($units as $name => $divisor) {
        if ($quot = intval($seconds / $divisor)) {
            $readable .= $quot . ' ' . $name;
            $readable .= (abs($quot) > 1 ? 's' : '') . ', ';
            $seconds -= $quot * $divisor;
        }
    }

    return substr($readable, 0, -2);
}

/**
 * Converts a numeric command number to the string representation
 *
 * @param int $command
 * @return string
 */
function command_name($command)
{
    if ($command === Command::DO_CLONE) {
        return 'clone';
    } elseif ($command === Command::DO_INSTALL) {
        return 'install';
    } elseif ($command === Command::DO_ACTIVATE) {
        return 'activate';
    }

    return 'purge';
}

/**
 * Gets the translated command label
 *
 * @param string $command
 * @return string
 */
function command_label($command)
{
    return Lang::get('commands.' . command_name($command));
}

/**
 * Gets a readable list of commands for a stage
 *
 * @todo Document this better
 */
function command_list_readable($commands, $step, $action)
{
    if (isset($commands[$step][$action])) {
        return implode(', ', $commands[$step][$action]);
    }

    return Lang::get('app.none');
}
<commit_msg>TODO comment<commit_after><?php

// TODO: Finish moving this logic to view presenters

use App\Command;

/**
 * Converts a number of seconds into a more human readable format
 *
 * @param int $seconds The number of seconds
 * @return string
 */
function human_readable_duration($seconds)
{
    $units = [
        'week'   => 7 * 24 * 3600,
        'day'    => 24 * 3600,
        'hour'   => 3600,
        'minute' => 60,
        'second' => 1
    ];

    if ($seconds == 0) {
        return '0 seconds';
    }

    $readable = '';
    foreach ($units as $name => $divisor) {
        if ($quot = intval($seconds / $divisor)) {
            $readable .= $quot . ' ' . $name;
            $readable .= (abs($quot) > 1 ? 's' : '') . ', ';
            $seconds -= $quot * $divisor;
        }
    }

    return substr($readable, 0, -2);
}

/**
 * Converts a numeric command number to the string representation
 *
 * @param int $command
 * @return string
 */
function command_name($command)
{
    if ($command === Command::DO_CLONE) {
        return Lang::get('commands.clone');
    } elseif ($command === Command::DO_INSTALL) {
        return Lang::get('commands.install');
    } elseif ($command === Command::DO_ACTIVATE) {
        return Lang::get('commands.activate');
    }

    return return Lang::get('commands.purge');
}

/**
 * Gets the translated command label
 *
 * @param string $command
 * @return string
 */
function command_label($command)
{
    return Lang::get('commands.' . command_name($command));
}

/**
 * Gets a readable list of commands for a stage
 *
 * @todo Document this better
 */
function command_list_readable($commands, $step, $action)
{
    if (isset($commands[$step][$action])) {
        return implode(', ', $commands[$step][$action]);
    }

    return Lang::get('app.none');
}

{'fraction_non_alphanumeric': 0.16580161476355249, 'fraction_numerical': 0.01441753171856978, 'mean_word_length': 2.5506653019447287, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '5659821', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1061, 'n_words': 292}