src/includes/classes/Core/CliOpts.php
public function parse(bool $extract = true, array $args = null)
    {
        $Parser = new OptionParser($this->OptionCollection);

        $OptionResult = $Options = $Parser->parse($args ?? $GLOBALS['argv']);

        if (!$extract) { // This contains some additional information for each option.
            return $OptionResult = $Options; // OptionResult|Option[]
        } else {
            $options = []; // Associative array (default behavior).

            foreach ($Options as $_key => $_Option) {
                $_key           = preg_replace('/[^a-z0-9]/ui', '_', $_key);
                $_value         = $_Option->getValue();
                $options[$_key] = $_value;
            } // unset($_key, $_value, $_Option);

            return $options; // Suitable for `extract()` now.
        }
    }
public function parse(bool $extract = true, array $args = null)
    {
        $Parser = new OptionParser($this->OptionCollection);

        $OptionResult = $Options = $Parser->parse($args ?? $GLOBALS['argv']);

        if (!$extract) { // This contains some additional information for each option.
            return $OptionResult = $Options; // OptionResult|Option[]
        } else {
            $options = []; // Associative array (default behavior).

            foreach ($Options as $_key => $_Option) {
                $_key           = preg_replace('/[^a-z0-9]/ui', '_', $_key);
                $_value         = $_Option->getValue();
                $options[$_key] = $_value;
            } // unset($_key, $_value, $_Option);

            return $options; // Suitable for `extract()` now.
        }
    }
Get options.

@since 150424 Initial release.

@param bool       $extract Extract into an array after parsing?
@param array|null $args    Args to parse; default is `$GLOBALS['argv']`.

@return array|OptionResult|Option[] Associative array, or the result set of Option objs.