src/Cli/CommandLine.php
public function parse($argv, $override = true)
    {
        $exists = [];
        $override ? $this->_values = $this->_defaults : $exists = array_fill_keys(array_keys($this->_values), true);

        foreach ($argv as $arg) {
            if ($arg === '--') {
                break;
            }
            if ($arg[0] === '-') {
                list($name, $value) = $this->_parse(ltrim($arg, '-'));
                if ($override || !isset($exists[$name])) {
                    $this->add($name, $value);
                }
            }
        }

        return $this->get();
    }
public function parse($argv, $override = true)
    {
        $exists = [];
        $override ? $this->_values = $this->_defaults : $exists = array_fill_keys(array_keys($this->_values), true);

        foreach ($argv as $arg) {
            if ($arg === '--') {
                break;
            }
            if ($arg[0] === '-') {
                list($name, $value) = $this->_parse(ltrim($arg, '-'));
                if ($override || !isset($exists[$name])) {
                    $this->add($name, $value);
                }
            }
        }

        return $this->get();
    }
public function parse ( $ argv , $ override = true ) { $ exists = [ ] ; $ override ? $ this -> _values = $ this -> _defaults : $ exists = array_fill_keys ( array_keys ( $ this -> _values ) , true ) ; foreach ( $ argv as $ arg ) { if ( $ arg === '--' ) { break ; } if ( $ arg [ 0 ] === '-' ) { list ( $ name , $ value ) = $ this -> _parse ( ltrim ( $ arg , '-' ) ) ; if ( $ override || ! isset ( $ exists [ $ name ] ) ) { $ this -> add ( $ name , $ value ) ; } } } return $ this -> get ( ) ; }
Parses a command line argv.

@param  array   $argv     An argv data.
@param  boolean $override If set to `false` it doesn't override already setted data.
@return array             The parsed attributes
Parses a command line argv .