original_string: protected function _parseOption($name, $params)
      {
          if (!isset($this->_options[$name])) {
              throw new ConsoleException($this->getOptionError($name));
          }
          $option = $this->_options[$name];
          $isBoolean = $option->isBoolean();
          $nextValue = $this->_nextToken();
          $emptyNextValue = (empty($nextValue) && $nextValue !== '0');
          if (!$isBoolean && !$emptyNextValue && !$this->_optionExists($nextValue)) {
              array_shift($this->_tokens);
              $value = $nextValue;
          } elseif ($isBoolean) {
              $value = true;
          } else {
              $value = $option->defaultValue();
          }
          if ($option->validChoice($value)) {
              if ($option->acceptsMultiple()) {
                  $params[$name][] = $value;
              } else {
                  $params[$name] = $value;
              }
  
              return $params;
          }
  
          return [];
      }
code: protected function _parseOption($name, $params)
      {
          if (!isset($this->_options[$name])) {
              throw new ConsoleException($this->getOptionError($name));
          }
          $option = $this->_options[$name];
          $isBoolean = $option->isBoolean();
          $nextValue = $this->_nextToken();
          $emptyNextValue = (empty($nextValue) && $nextValue !== '0');
          if (!$isBoolean && !$emptyNextValue && !$this->_optionExists($nextValue)) {
              array_shift($this->_tokens);
              $value = $nextValue;
          } elseif ($isBoolean) {
              $value = true;
          } else {
              $value = $option->defaultValue();
          }
          if ($option->validChoice($value)) {
              if ($option->acceptsMultiple()) {
                  $params[$name][] = $value;
              } else {
                  $params[$name] = $value;
              }
  
              return $params;
          }
  
          return [];
      }
code_tokens: protected function _parseOption ( $ name , $ params ) { if ( ! isset ( $ this -> _options [ $ name ] ) ) { throw new ConsoleException ( $ this -> getOptionError ( $ name ) ) ; } $ option = $ this -> _options [ $ name ] ; $ isBoolean = $ option -> isBoolean ( ) ; $ nextValue = $ this -> _nextToken ( ) ; $ emptyNextValue = ( empty ( $ nextValue ) && $ nextValue !== '0' ) ; if ( ! $ isBoolean && ! $ emptyNextValue && ! $ this -> _optionExists ( $ nextValue ) ) { array_shift ( $ this -> _tokens ) ; $ value = $ nextValue ; } elseif ( $ isBoolean ) { $ value = true ; } else { $ value = $ option -> defaultValue ( ) ; } if ( $ option -> validChoice ( $ value ) ) { if ( $ option -> acceptsMultiple ( ) ) { $ params [ $ name ] [ ] = $ value ; } else { $ params [ $ name ] = $ value ; } return $ params ; } return [ ] ; }
docstring: Parse an option by its name index.
  
  @param string $name The name to parse.
  @param array $params The params to append the parsed value into
  @return array Params with $option added in.
  @throws \Cake\Console\Exception\ConsoleException
docstring_tokens: Parse an option by its name index .