src/Ulrichsg/Getopt/Getopt.php
public function parse($arguments = null)
    {
        $this->options = array();
        if (!isset($arguments)) {
            global $argv;
            $arguments = $argv;
            $this->scriptName = array_shift($arguments); // $argv[0] is the script's name
        } elseif (is_string($arguments)) {
            $this->scriptName = $_SERVER['PHP_SELF'];
            $arguments = explode(' ', $arguments);
        }

        $parser = new CommandLineParser($this->optionList);
        $parser->parse($arguments);
        $this->options = $parser->getOptions();
        $this->operands = $parser->getOperands();
    }
public function parse($arguments = null)
    {
        $this->options = array();
        if (!isset($arguments)) {
            global $argv;
            $arguments = $argv;
            $this->scriptName = array_shift($arguments); // $argv[0] is the script's name
        } elseif (is_string($arguments)) {
            $this->scriptName = $_SERVER['PHP_SELF'];
            $arguments = explode(' ', $arguments);
        }

        $parser = new CommandLineParser($this->optionList);
        $parser->parse($arguments);
        $this->options = $parser->getOptions();
        $this->operands = $parser->getOperands();
    }
public function parse ( $ arguments = null ) { $ this -> options = array ( ) ; if ( ! isset ( $ arguments ) ) { global $ argv ; $ arguments = $ argv ; $ this -> scriptName = array_shift ( $ arguments ) ; // $argv[0] is the script's name } elseif ( is_string ( $ arguments ) ) { $ this -> scriptName = $ _SERVER [ 'PHP_SELF' ] ; $ arguments = explode ( ' ' , $ arguments ) ; } $ parser = new CommandLineParser ( $ this -> optionList ) ; $ parser -> parse ( $ arguments ) ; $ this -> options = $ parser -> getOptions ( ) ; $ this -> operands = $ parser -> getOperands ( ) ; }
Evaluate the given arguments. These can be passed either as a string or as an array.
If nothing is passed, the running script's command line arguments are used.

An {@link \UnexpectedValueException} or {@link \InvalidArgumentException} is thrown
when the arguments are not well-formed or do not conform to the options passed by the user.

@param mixed $arguments optional ARGV array or space separated string
Evaluate the given arguments . These can be passed either as a string or as an array . If nothing is passed the running script s command line arguments are used .