<commit_before><?php

namespace REBELinBLUE\Deployer\Presenters;

use Illuminate\Support\Facades\Lang;
use REBELinBLUE\Deployer\Deployment;
use REBELinBLUE\Deployer\Presenters\Traits\RuntimePresenter;
use Robbo\Presenter\Presenter;

/**
 * The view presenter for a project class.
 */
class DeploymentPresenter extends Presenter
{
    use RuntimePresenter;

    /**
     * Returns the build status needed by CCTray
     * These strings can not be translated.
     *
     * @return string
     */
    public function presentCcTrayStatus()
    {
        if ($this->status === Deployment::COMPLETED || $this->status === Deployment::COMPLETED_WITH_ERRORS) {
            return 'Success';
        } elseif ($this->status === Deployment::FAILED || $this->status === Deployment::ABORTED) {
            return 'Failure';
        }

        return 'Unknown';
    }

    /**
     * Gets the translated deployment status string.
     *
     * @return string
     */
    public function presentReadableStatus()
    {
        if ($this->status === Deployment::COMPLETED) {
            return Lang::get('deployments.completed');
        } elseif ($this->status === Deployment::COMPLETED_WITH_ERRORS) {
            return Lang::get('deployments.completed_with_errors');
        } elseif ($this->status === Deployment::ABORTING) {
            return Lang::get('deployments.aborting');
        } elseif ($this->status === Deployment::ABORTED) {
            return Lang::get('deployments.aborted');
        } elseif ($this->status === Deployment::FAILED) {
            return Lang::get('deployments.failed');
        } elseif ($this->status === Deployment::DEPLOYING) {
            return Lang::get('deployments.deploying');
        }

        return Lang::get('deployments.pending');
    }

    /**
     * Gets the IDs of the optional commands which were included in the deployments, for use in a data attribute.
     *
     * @return string
     */
    public function presentOptionalCommandsUsed()
    {
        $commands = [];

        foreach ($this->object->commands as $command)
        {
            $commands[] = $command->id;
        }


        return implode(',', $commands);
    }

    /**
     * Gets the CSS icon class for the deployment status.
     *
     * @return string
     */
    public function presentIcon()
    {
        $finished_statuses = [Deployment::FAILED, Deployment::COMPLETED_WITH_ERRORS,
                              Deployment::ABORTING, Deployment::ABORTED, ];
<commit_msg>Filter optional commands<commit_after><?php

namespace REBELinBLUE\Deployer\Presenters;

use Illuminate\Support\Facades\Lang;
use REBELinBLUE\Deployer\Deployment;
use REBELinBLUE\Deployer\Presenters\Traits\RuntimePresenter;
use Robbo\Presenter\Presenter;

/**
 * The view presenter for a project class.
 */
class DeploymentPresenter extends Presenter
{
    use RuntimePresenter;

    /**
     * Returns the build status needed by CCTray
     * These strings can not be translated.
     *
     * @return string
     */
    public function presentCcTrayStatus()
    {
        if ($this->status === Deployment::COMPLETED || $this->status === Deployment::COMPLETED_WITH_ERRORS) {
            return 'Success';
        } elseif ($this->status === Deployment::FAILED || $this->status === Deployment::ABORTED) {
            return 'Failure';
        }

        return 'Unknown';
    }

    /**
     * Gets the translated deployment status string.
     *
     * @return string
     */
    public function presentReadableStatus()
    {
        if ($this->status === Deployment::COMPLETED) {
            return Lang::get('deployments.completed');
        } elseif ($this->status === Deployment::COMPLETED_WITH_ERRORS) {
            return Lang::get('deployments.completed_with_errors');
        } elseif ($this->status === Deployment::ABORTING) {
            return Lang::get('deployments.aborting');
        } elseif ($this->status === Deployment::ABORTED) {
            return Lang::get('deployments.aborted');
        } elseif ($this->status === Deployment::FAILED) {
            return Lang::get('deployments.failed');
        } elseif ($this->status === Deployment::DEPLOYING) {
            return Lang::get('deployments.deploying');
        }

        return Lang::get('deployments.pending');
    }

    /**
     * Gets the IDs of the optional commands which were included in the deployments, for use in a data attribute.
     *
     * @return string
     */
    public function presentOptionalCommandsUsed()
    {
        $commands = [];

        foreach ($this->object->commands as $command) {
            if ($command->optional) {
                $commands[] = $command->id;
            }
        }


        return implode(',', $commands);
    }

    /**
     * Gets the CSS icon class for the deployment status.
     *
     * @return string
     */
    public function presentIcon()
    {
        $finished_statuses = [Deployment::FAILED, Deployment::COMPLETED_WITH_ERRORS,
                              Deployment::ABORTING, Deployment::ABORTED, ];

{'fraction_non_alphanumeric': 0.12750347015665278, 'fraction_numerical': 0.0, 'mean_word_length': 2.4642857142857144, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, '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': '6799965', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1408, 'n_words': 312}