original_string: public function registerCommands(string $plugin, array $commands)
      {
          $newCommands = [];
  
          foreach($commands as $commandClass) {
              $command = new $commandClass($plugin);
              $command = CommandFactory::setNamespace($command);
              $this->add($command);
              $newCommands[] = $command;
          }
          return $newCommands;
      }
code: public function registerCommands(string $plugin, array $commands)
      {
          $newCommands = [];
  
          foreach($commands as $commandClass) {
              $command = new $commandClass($plugin);
              $command = CommandFactory::setNamespace($command);
              $this->add($command);
              $newCommands[] = $command;
          }
          return $newCommands;
      }
code_tokens: public function registerCommands ( string $ plugin , array $ commands ) { $ newCommands = [ ] ; foreach ( $ commands as $ commandClass ) { $ command = new $ commandClass ( $ plugin ) ; $ command = CommandFactory :: setNamespace ( $ command ) ; $ this -> add ( $ command ) ; $ newCommands [ ] = $ command ; } return $ newCommands ; }
docstring: Register all commands for a given plugin
  
  @param string $plugin The plugin these commands will be registered for
  @param array $commands array containing the classnames of the commands
  
  @return array $newCommands array containing JinitializeCommand objects
docstring_tokens: Register all commands for a given plugin