src/CLIParser.php
private function getopt()
    {

        // Reset option argument
        $this->optarg = null;
        
        // Check for index validity
        if ($this->optind >= $this->argc) {
            return -1;
        }

        // Get a copy of the current option to examine
        $arg = $this->argv[$this->optind];

        if ($this->isLongOption($arg)) {
            return $this->parseLongOption($arg);
        }

        if ($this->isShortOption($arg)) {
            return $this->parseShortOption($arg);
        }

        // If it's not an option, it's an argument,
        // so we stop parsing at the first non-option string
        // and $this->optind points to the first argument

        // Default: no options found
        return -1;
    }
private function getopt()
    {

        // Reset option argument
        $this->optarg = null;
        
        // Check for index validity
        if ($this->optind >= $this->argc) {
            return -1;
        }

        // Get a copy of the current option to examine
        $arg = $this->argv[$this->optind];

        if ($this->isLongOption($arg)) {
            return $this->parseLongOption($arg);
        }

        if ($this->isShortOption($arg)) {
            return $this->parseShortOption($arg);
        }

        // If it's not an option, it's an argument,
        // so we stop parsing at the first non-option string
        // and $this->optind points to the first argument

        // Default: no options found
        return -1;
    }
private function getopt ( ) { // Reset option argument $ this -> optarg = null ; // Check for index validity if ( $ this -> optind >= $ this -> argc ) { return - 1 ; } // Get a copy of the current option to examine $ arg = $ this -> argv [ $ this -> optind ] ; if ( $ this -> isLongOption ( $ arg ) ) { return $ this -> parseLongOption ( $ arg ) ; } if ( $ this -> isShortOption ( $ arg ) ) { return $ this -> parseShortOption ( $ arg ) ; } // If it's not an option, it's an argument, // so we stop parsing at the first non-option string // and $this->optind points to the first argument // Default: no options found return - 1 ; }
Searches for a valid next option

If the option is not valid returns NULL, if there is no option returns -1

@return mixed | NULL
Searches for a valid next option