original_string: protected function resolveName($commands, $io, $name)
      {
          if (!$name) {
              $io->err('<error>No command provided. Choose one of the available commands.</error>', 2);
              $name = 'help';
          }
          if (isset($this->aliases[$name])) {
              $name = $this->aliases[$name];
          }
          if (!$commands->has($name)) {
              $name = Inflector::underscore($name);
          }
          if (!$commands->has($name)) {
              throw new RuntimeException(
                  "Unknown command `{$this->root} {$name}`." .
                  " Run `{$this->root} --help` to get the list of valid commands."
              );
          }
  
          return $name;
      }
code: protected function resolveName($commands, $io, $name)
      {
          if (!$name) {
              $io->err('<error>No command provided. Choose one of the available commands.</error>', 2);
              $name = 'help';
          }
          if (isset($this->aliases[$name])) {
              $name = $this->aliases[$name];
          }
          if (!$commands->has($name)) {
              $name = Inflector::underscore($name);
          }
          if (!$commands->has($name)) {
              throw new RuntimeException(
                  "Unknown command `{$this->root} {$name}`." .
                  " Run `{$this->root} --help` to get the list of valid commands."
              );
          }
  
          return $name;
      }
code_tokens: protected function resolveName ( $ commands , $ io , $ name ) { if ( ! $ name ) { $ io -> err ( '<error>No command provided. Choose one of the available commands.</error>' , 2 ) ; $ name = 'help' ; } if ( isset ( $ this -> aliases [ $ name ] ) ) { $ name = $ this -> aliases [ $ name ] ; } if ( ! $ commands -> has ( $ name ) ) { $ name = Inflector :: underscore ( $ name ) ; } if ( ! $ commands -> has ( $ name ) ) { throw new RuntimeException ( "Unknown command `{$this->root} {$name}`." . " Run `{$this->root} --help` to get the list of valid commands." ) ; } return $ name ; }
docstring: Resolve the command name into a name that exists in the collection.
  
  Apply backwards compatible inflections and aliases.
  Will step forward up to 3 tokens in $argv to generate
  a command name in the CommandCollection. More specific
  command names take precedence over less specific ones.
  
  @param \Cake\Console\CommandCollection $commands The command collection to check.
  @param \Cake\Console\ConsoleIo $io ConsoleIo object for errors.
  @param string $name The name
  @return string The resolved class name
docstring_tokens: Resolve the command name into a name that exists in the collection .