<commit_before><?php



namespace FJ;



abstract class CLI
{
    private   $argc;
    private   $argv;
    protected $opts      = [];
    protected $remaining = [];



    /**
     * This provides a list of the short options, in class getopts format.
     *
     * @return string
     */
    protected function getShortOpts () { return ""; }

    /**
     * This provides an array of the long options.
     *
     * @return array
     */
    protected function getLongOpts () { return []; }

    /**
     * CLI entry point.
     *
     * @return int
     */
    abstract public function main ();



    protected function argc () { return $this->argc; }
    protected function argv () { return $this->argv; }


<commit_msg>Adds "nicer" argument handling (shift & friends).<commit_after><?php



namespace FJ;



abstract class CLI
{
    private   $argc;
    private   $argv;
    protected $opts      = [];
    protected $remaining = [];



    /**
     * This provides a list of the short options, in class getopts format.
     *
     * @return string
     */
    protected function getShortOpts () { return ""; }

    /**
     * This provides an array of the long options.
     *
     * @return array
     */
    protected function getLongOpts () { return []; }

    /**
     * CLI entry point.
     *
     * @return int
     */
    abstract public function main ();



    protected function argc () { return $this->argc; }
    protected function argv () { return $this->argv; }


    private $argIndex = 0;
    function shift () { return $this->nextArg(); }
    function nextArg () { return $this->remaining[$this->argIndex++]; }
    function resetArgs () { $this->argIndex = 0; }



{'fraction_non_alphanumeric': 0.12625963248369887, 'fraction_numerical': 0.0011855364552459987, 'mean_word_length': 2.1029411764705883, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '1918380', 'n_tokens_mistral': 497, 'n_tokens_neox': 471, 'n_words': 150}