code: private function createController(): void
      {
          $aFields  = $this->getArguments();
          $aCreated = [];
  
          try {
  
              $aModels = array_filter(explode(',', $aFields['MODEL_NAME']));
  
              foreach ($aModels as $sModel) {
  
                  $aFields['MODEL_NAME'] = $sModel;
                  $this->oOutput->write('Creating controller <comment>' . $sModel . '</comment>... ');
  
                  //  Validate model exists by attempting to load it
                  Factory::model($sModel, $aFields['MODEL_PROVIDER']);
  
                  //  Check for existing controller
                  $sPath = static::CONTROLLER_PATH . $sModel . '.php';
                  if (file_exists($sPath)) {
                      throw new ControllerExistsException(
                          'Controller "' . $sModel . '" exists already at path "' . $sPath . '"'
                      );
                  }
  
                  $this->createFile($sPath, $this->getResource('template/controller.php', $aFields));
                  $aCreated[] = $sPath;
                  $this->oOutput->writeln('<info>done!</info>');
              }
  
          } catch (\Exception $e) {
              $this->oOutput->writeln('<error>failed!</error>');
              //  Clean up created models
              if (!empty($aCreated)) {
                  $this->oOutput->writeln('<error>Cleaning up - removing newly created controllers</error>');
                  foreach ($aCreated as $sPath) {
                      @unlink($sPath);
                  }
              }
              throw $e;
          }
      }
docs: Create the Model
  
  @throws \Exception
  @return void