src/Koldy/Cli.php
protected static function parseArgvIntoParameters(): void
    {
        if (static::$parameters === null) {
            static::$parameters = [];
            $argv = static::getArgv();
            array_shift($argv); // remove the script name, it's not needed
            $sizeof = count($argv);

            for ($i = 0; $i < $sizeof; $i++) {
                $p = $argv[$i];

                if (substr($p, 0, 2) == '--') {
                    $tmp = explode('=', $p);
                    static::$parameters[substr($tmp[0], 2)] = $tmp[1] ?? null;

                } else if (substr($p, 0, 1) == '-' && isset($argv[$i + 1]) && substr($argv[$i + 1], 0, 1) != '-') {
                    static::$parameters[substr($p, 1)] = $argv[$i + 1] ?? null;

                } else if (substr($p, 0, 1) == '-' && preg_match('/^[a-zA-Z]$/', substr($p, 1, 1))) {
                    static::$parameters[substr($p, 1, 1)] = null;

                }

            }
        }
    }
protected static function parseArgvIntoParameters(): void
    {
        if (static::$parameters === null) {
            static::$parameters = [];
            $argv = static::getArgv();
            array_shift($argv); // remove the script name, it's not needed
            $sizeof = count($argv);

            for ($i = 0; $i < $sizeof; $i++) {
                $p = $argv[$i];

                if (substr($p, 0, 2) == '--') {
                    $tmp = explode('=', $p);
                    static::$parameters[substr($tmp[0], 2)] = $tmp[1] ?? null;

                } else if (substr($p, 0, 1) == '-' && isset($argv[$i + 1]) && substr($argv[$i + 1], 0, 1) != '-') {
                    static::$parameters[substr($p, 1)] = $argv[$i + 1] ?? null;

                } else if (substr($p, 0, 1) == '-' && preg_match('/^[a-zA-Z]$/', substr($p, 1, 1))) {
                    static::$parameters[substr($p, 1, 1)] = null;

                }

            }
        }
    }
protected static function parseArgvIntoParameters ( ) : void { if ( static :: $ parameters === null ) { static :: $ parameters = [ ] ; $ argv = static :: getArgv ( ) ; array_shift ( $ argv ) ; // remove the script name, it's not needed $ sizeof = count ( $ argv ) ; for ( $ i = 0 ; $ i < $ sizeof ; $ i ++ ) { $ p = $ argv [ $ i ] ; if ( substr ( $ p , 0 , 2 ) == '--' ) { $ tmp = explode ( '=' , $ p ) ; static :: $ parameters [ substr ( $ tmp [ 0 ] , 2 ) ] = $ tmp [ 1 ] ?? null ; } else if ( substr ( $ p , 0 , 1 ) == '-' && isset ( $ argv [ $ i + 1 ] ) && substr ( $ argv [ $ i + 1 ] , 0 , 1 ) != '-' ) { static :: $ parameters [ substr ( $ p , 1 ) ] = $ argv [ $ i + 1 ] ?? null ; } else if ( substr ( $ p , 0 , 1 ) == '-' && preg_match ( '/^[a-zA-Z]$/' , substr ( $ p , 1 , 1 ) ) ) { static :: $ parameters [ substr ( $ p , 1 , 1 ) ] = null ; } } } }
Parse the script arguments into parameters ready for later use
@throws CliException
Parse the script arguments into parameters ready for later use