<commit_before><?php

namespace SF;

/*
 * This file is part of the SimpleFrameworke
 *
 * (c) <NAME> <<EMAIL>>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

class Console
{
    private $kernel;
    private $commands;

    public function __construct(Kernel $kernel, $commands = array())
    {
        $this->kernel = $kernel;
        $this->commands = $commands;
    }

    public function register($name, $command)
    {
        $this->commands[$name] = $command;
    }

    public function run($argv)
    {
        if (!isset($argv[1])) {
            echo "please specify a command:\n";
            echo '- '.implode("\n- ", array_keys($this->commands));
            exit;
        }

        $name = $argv[1];

        if (!isset($this->commands[$name])) {
            echo "invalid command '{$name}'\n";
            exit;
        }

        $command = $this->commands[$name];
        $args = array_splice($argv, 0, 2);

        $pair = true;
        $prev;
        foreach ($argv as $k => $val) {
            if (!$pair) {
            $argv[$prev] = $val;
            } else {
                $prev = $val;
            }
            $pair = !$pair;
            unset($argv[$k]);
        }

        if (!method_exists($command, 'run')) {
            echo "command '{$name}' should have a run() method\n";
            exit;
        }

        $command->run($this->kernel->getContainer(), $argv);
    }
}<commit_msg>[Console] removed logic when parsing arguments<commit_after><?php

namespace SF;

/*
 * This file is part of the SimpleFrameworke
 *
 * (c) <NAME> <<EMAIL>>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

class Console
{
    private $kernel;
    private $commands;

    public function __construct(Kernel $kernel, $commands = array())
    {
        $this->kernel = $kernel;
        $this->commands = $commands;
    }

    public function register($name, $command)
    {
        $this->commands[$name] = $command;
    }

    public function run($argv)
    {
        if (!isset($argv[1])) {
            echo "please specify a command:\n";
            echo '- '.implode("\n- ", array_keys($this->commands));
            exit;
        }

        $name = $argv[1];

        if (!isset($this->commands[$name])) {
            echo "invalid command '{$name}'\n";
            exit;
        }

        array_splice($argv, 0, 2);

        if (!method_exists($command = $this->commands[$name], 'run')) {
            echo "command '{$name}' should have a run() method\n";
            exit;
        }

        $command->run($this->kernel->getContainer(), $argv);
    }
}
{'fraction_non_alphanumeric': 0.15630746598013975, 'fraction_numerical': 0.002942258183155572, 'mean_word_length': 1.8966986155484558, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 28, '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': '4509563', 'n_tokens_mistral': 812, 'n_tokens_neox': 786, 'n_words': 217}