<commit_before><?php

namespace Robo\Task\Shared;

use Robo\Task\Exec;
use Robo\Task\Shared\DynamicConfig;

class CommandStack implements CommandInterface, TaskInterface
{
    use DynamicConfig;
    use Exec;

    protected $executable;
    protected $result;
    protected $exec = [];
    protected $stopOnFail = false;

    public function getCommand()
    {
        return implode(' && ', $this->exec);
    }

    public function exec($command)
    {
        if (is_array($command)) {
            $command = implode(' ', array_filter($command));
        }

        array_push($this->exec, trim(ltrim($command, $this->executable)));
        return $this;
    }

    public function run()
    {
        if (!$this->stopOnFail) {
            return $this->taskExec($this->getCommand())->run();
        }

        foreach ($this->exec as $command) {
            $result = $this->taskExec($command)->run();
            if (!$result->wasSuccessful()) {
                return $result;
            }
        }

        return Result::success($this);
    }
}
<commit_msg>Fix cases with executable.<commit_after><?php

namespace Robo\Task\Shared;

use Robo\Result;
use Robo\Task\Exec;
use Robo\Task\Shared\DynamicConfig;

class CommandStack implements CommandInterface, TaskInterface
{
    use DynamicConfig;
    use Exec;

    protected $executable;
    protected $result;
    protected $exec = [];
    protected $stopOnFail = false;

    public function getCommand()
    {
        return implode(' && ', $this->exec);
    }

    public function exec($command)
    {
        if (is_array($command)) {
            $command = implode(' ', array_filter($command));
        }

        $command = $this->executable . ' ' . trim(ltrim($command, $this->executable));
        array_push($this->exec, trim($command));
        return $this;
    }

    public function run()
    {
        if (!$this->stopOnFail) {
            return $this->taskExec($this->getCommand())->run();
        }

        foreach ($this->exec as $command) {
            $result = $this->taskExec($command)->run();
            if (!$result->wasSuccessful()) {
                return $result;
            }
        }

        return Result::success($this);
    }
}

{'fraction_non_alphanumeric': 0.145748987854251, 'fraction_numerical': 0.0, 'mean_word_length': 2.227866473149492, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, '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': '906551', 'n_tokens_mistral': 646, 'n_tokens_neox': 630, 'n_words': 134}