original_string: public function add($name, $command)
      {
          // Once we have a new Command class this should check
          // against that interface.
          if (!is_subclass_of($command, Shell::class) && !is_subclass_of($command, Command::class)) {
              $class = is_string($command) ? $command : get_class($command);
              throw new InvalidArgumentException(
                  "Cannot use '$class' for command '$name' it is not a subclass of Cake\Console\Shell or Cake\Console\Command."
              );
          }
          if (!preg_match('/^[^\s]+(?:(?: [^\s]+){1,2})?$/ui', $name)) {
              throw new InvalidArgumentException(
                  "The command name `{$name}` is invalid. Names can only be a maximum of three words."
              );
          }
  
          $this->commands[$name] = $command;
  
          return $this;
      }
code: public function add($name, $command)
      {
          // Once we have a new Command class this should check
          // against that interface.
          if (!is_subclass_of($command, Shell::class) && !is_subclass_of($command, Command::class)) {
              $class = is_string($command) ? $command : get_class($command);
              throw new InvalidArgumentException(
                  "Cannot use '$class' for command '$name' it is not a subclass of Cake\Console\Shell or Cake\Console\Command."
              );
          }
          if (!preg_match('/^[^\s]+(?:(?: [^\s]+){1,2})?$/ui', $name)) {
              throw new InvalidArgumentException(
                  "The command name `{$name}` is invalid. Names can only be a maximum of three words."
              );
          }
  
          $this->commands[$name] = $command;
  
          return $this;
      }
code_tokens: public function add ( $ name , $ command ) { // Once we have a new Command class this should check // against that interface. if ( ! is_subclass_of ( $ command , Shell :: class ) && ! is_subclass_of ( $ command , Command :: class ) ) { $ class = is_string ( $ command ) ? $ command : get_class ( $ command ) ; throw new InvalidArgumentException ( "Cannot use '$class' for command '$name' it is not a subclass of Cake\Console\Shell or Cake\Console\Command." ) ; } if ( ! preg_match ( '/^[^\s]+(?:(?: [^\s]+){1,2})?$/ui' , $ name ) ) { throw new InvalidArgumentException ( "The command name `{$name}` is invalid. Names can only be a maximum of three words." ) ; } $ this -> commands [ $ name ] = $ command ; return $ this ; }
docstring: Add a command to the collection
  
  @param string $name The name of the command you want to map.
  @param string|\Cake\Console\Shell|\Cake\Console\Command $command The command to map.
  @return $this
docstring_tokens: Add a command to the collection