public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
    {
        if (empty($name)) {
            throw new \InvalidArgumentException('An option name cannot be empty.');
        }

        if (null === $mode) {
            $mode = self::VALUE_NONE;
        } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
            throw new \InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
        }

        $this->options[] = [$name, $shortcut, $mode, $description, $default];
    }
public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
    {
        if (empty($name)) {
            throw new \InvalidArgumentException('An option name cannot be empty.');
        }

        if (null === $mode) {
            $mode = self::VALUE_NONE;
        } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
            throw new \InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
        }

        $this->options[] = [$name, $shortcut, $mode, $description, $default];
    }
public function addOption ( $ name , $ shortcut = null , $ mode = null , $ description = '' , $ default = null ) { if ( empty ( $ name ) ) { throw new \ InvalidArgumentException ( 'An option name cannot be empty.' ) ; } if ( null === $ mode ) { $ mode = self :: VALUE_NONE ; } elseif ( ! is_int ( $ mode ) || $ mode > 15 || $ mode < 1 ) { throw new \ InvalidArgumentException ( sprintf ( 'Option mode "%s" is not valid.' , $ mode ) ) ; } $ this -> options [ ] = [ $ name , $ shortcut , $ mode , $ description , $ default ] ; }
Adds a new command option.

@param string       $name        The option name
@param string|array $shortcut    The shortcuts, can be null, a string of shortcuts delimited
by | or an array of shortcuts
@param int          $mode        The option mode: One of the VALUE_* constants
@param string       $description A description text
@param mixed        $default     The default value (must be null for self::VALUE_REQUIRED or self::VALUE_NONE)

@throws \InvalidArgumentException If name is empty or option mode is invalid or incompatible
Adds a new command option .