<commit_before><?php
/**
 * This file is part of the PHPLucidFrame library.
 * Command-line code generation utility to automate programmer tasks.
 *
 * @package     LC\Helpers\Console
 * @since       PHPLucidFrame v 1.11.0
 * @copyright   Copyright (c), PHPLucidFrame.
 * @author      <NAME>. <<EMAIL>>
 * @link        http://phplucidframe.sithukyaw.com
 * @license     http://www.opensource.org/licenses/mit-license.php MIT License
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.txt
 */

namespace LucidFrame\Console;

class Console
{
    /** @var LucidFrame\Console\Command The command being run **/
    protected $command;
    /** @var string The command name **/
    private $commandName;
    /** @var integer No of arguments passed to script **/
    protected $argc;
    /** @var array Array of arguments passed to script **/
    protected $argv;
    /** @var array list of registered commands **/
    protected static $commands = array();

    /**
     * Constructor
     */
    public function __construct()
    {
        global $argv;

        $this->argv = array_slice($argv, 1);
        $this->argc = count($this->argv) - 1;
        $this->commandName  = array_shift($this->argv);
        $this->command      = $this->getCommand($this->commandName);

        $this->execute();
    }

    /**
     * Register a command
     * @param LucidFrame\Console\Command $command
     * @return void
     */
    public static function registerCommand($command)
    {
        self::$commands[$command->getName()] = $command;
    }

    /**
     * Get all registered commands
     * @return array Array of LucidFrame\Console\Command
     */
    public static function getCommands()
    {
        return self::$commands;
    }

    /**
     * Check a command name is already registered
     * @param string $name The command name
     * @return boolean
     */
    public function hasCommand($name)
    {
        return array_key_exists($name, self::$commands);
    }

    /**
     * Get the command by name
     * @param string $name The command name
     * @return object|null LucidFrame\Console\Command
     */
    public function getCommand($name)
    {
        return $this->hasCommand($name) ? self::$commands[$name] : null;
    }

    /**
     * Execute the current command
     */
    private function execute()
    {
        _writeln('PHPLucidFrame %s by Sithu K.', _version());
        _writeln();

        if ($this->command instanceof \LucidFrame\Console\Command) {
            $this->command->run($this->argv);
        } else {
            if (empty($this->command) || in_array($this->command, array('-V', '--version'))) {
                _writeln(_version());
            } else {
                _writeln('Command "%s" not found.', $this->commandName);
            }
        }
    }
}
<commit_msg>Add more info for the command `php lucidframe --version`<commit_after><?php
/**
 * This file is part of the PHPLucidFrame library.
 * Command-line code generation utility to automate programmer tasks.
 *
 * @package     LC\Helpers\Console
 * @since       PHPLucidFrame v 1.11.0
 * @copyright   Copyright (c), PHPLucidFrame.
 * @author      <NAME>. <<EMAIL>>
 * @link        http://phplucidframe.sithukyaw.com
 * @license     http://www.opensource.org/licenses/mit-license.php MIT License
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.txt
 */

namespace LucidFrame\Console;

class Console
{
    /** @var LucidFrame\Console\Command The command being run **/
    protected $command;
    /** @var string The command name **/
    private $commandName;
    /** @var integer No of arguments passed to script **/
    protected $argc;
    /** @var array Array of arguments passed to script **/
    protected $argv;
    /** @var array list of registered commands **/
    protected static $commands = array();

    /**
     * Constructor
     */
    public function __construct()
    {
        global $argv;

        $this->argv = array_slice($argv, 1);
        $this->argc = count($this->argv) - 1;
        $this->commandName  = array_shift($this->argv);
        $this->command      = $this->getCommand($this->commandName);

        $this->execute();
    }

    /**
     * Register a command
     * @param LucidFrame\Console\Command $command
     * @return void
     */
    public static function registerCommand($command)
    {
        self::$commands[$command->getName()] = $command;
    }

    /**
     * Get all registered commands
     * @return array Array of LucidFrame\Console\Command
     */
    public static function getCommands()
    {
        return self::$commands;
    }

    /**
     * Check a command name is already registered
     * @param string $name The command name
     * @return boolean
     */
    public function hasCommand($name)
    {
        return array_key_exists($name, self::$commands);
    }

    /**
     * Get the command by name
     * @param string $name The command name
     * @return object|null LucidFrame\Console\Command
     */
    public function getCommand($name)
    {
        return $this->hasCommand($name) ? self::$commands[$name] : null;
    }

    /**
     * Execute the current command
     */
    private function execute()
    {
        _writeln('PHPLucidFrame %s by Sithu K.', _version());
        _writeln();

        if ($this->command instanceof \LucidFrame\Console\Command) {
            $this->command->run($this->argv);
        } else {
            if (empty($this->command) || in_array($this->command, array('-V', '--version'))) {
                _writeln(_version());
                _writeln('PHP Version: %s', phpversion());
                _writeln('The MIT License');
                _writeln('Simple, lightweight & yet powerful PHP Application Framework');
                _writeln('Copyright (c) 2014-%d, PHPLucidFrame.', date('Y'));
            } else {
                _writeln('Command "%s" not found.', $this->commandName);
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.13095827148276432, 'fraction_numerical': 0.002638957611743361, 'mean_word_length': 2.2760669908157753, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6475881', 'n_tokens_mistral': 1728, 'n_tokens_neox': 1689, 'n_words': 477}