original_string: public function addOption($name, array $options = [])
      {
          if ($name instanceof ConsoleInputOption) {
              $option = $name;
              $name = $option->name();
          } else {
              $defaults = [
                  'name' => $name,
                  'short' => null,
                  'help' => '',
                  'default' => null,
                  'boolean' => false,
                  'choices' => []
              ];
              $options += $defaults;
              $option = new ConsoleInputOption($options);
          }
          $this->_options[$name] = $option;
          asort($this->_options);
          if ($option->short() !== null) {
              $this->_shortOptions[$option->short()] = $name;
              asort($this->_shortOptions);
          }
  
          return $this;
      }
code: public function addOption($name, array $options = [])
      {
          if ($name instanceof ConsoleInputOption) {
              $option = $name;
              $name = $option->name();
          } else {
              $defaults = [
                  'name' => $name,
                  'short' => null,
                  'help' => '',
                  'default' => null,
                  'boolean' => false,
                  'choices' => []
              ];
              $options += $defaults;
              $option = new ConsoleInputOption($options);
          }
          $this->_options[$name] = $option;
          asort($this->_options);
          if ($option->short() !== null) {
              $this->_shortOptions[$option->short()] = $name;
              asort($this->_shortOptions);
          }
  
          return $this;
      }
code_tokens: public function addOption ( $ name , array $ options = [ ] ) { if ( $ name instanceof ConsoleInputOption ) { $ option = $ name ; $ name = $ option -> name ( ) ; } else { $ defaults = [ 'name' => $ name , 'short' => null , 'help' => '' , 'default' => null , 'boolean' => false , 'choices' => [ ] ] ; $ options += $ defaults ; $ option = new ConsoleInputOption ( $ options ) ; } $ this -> _options [ $ name ] = $ option ; asort ( $ this -> _options ) ; if ( $ option -> short ( ) !== null ) { $ this -> _shortOptions [ $ option -> short ( ) ] = $ name ; asort ( $ this -> _shortOptions ) ; } return $ this ; }
docstring: Add an option to the option parser. Options allow you to define optional or required
  parameters for your console application. Options are defined by the parameters they use.
  
  ### Options
  
  - `short` - The single letter variant for this option, leave undefined for none.
  - `help` - Help text for this option. Used when generating help for the option.
  - `default` - The default value for this option. Defaults are added into the parsed params when the
  attached option is not provided or has no value. Using default and boolean together will not work.
  are added into the parsed parameters when the option is undefined. Defaults to null.
  - `boolean` - The option uses no value, it's just a boolean switch. Defaults to false.
  If an option is defined as boolean, it will always be added to the parsed params. If no present
  it will be false, if present it will be true.
  - `multiple` - The option can be provided multiple times. The parsed option
  will be an array of values when this option is enabled.
  - `choices` A list of valid choices for this option. If left empty all values are valid..
  An exception will be raised when parse() encounters an invalid value.
  
  @param \Cake\Console\ConsoleInputOption|string $name The long name you want to the value to be parsed out as when options are parsed.
  Will also accept an instance of ConsoleInputOption
  @param array $options An array of parameters that define the behavior of the option
  @return $this
docstring_tokens: Add an option to the option parser . Options allow you to define optional or required parameters for your console application . Options are defined by the parameters they use .