/**
  * Display index of actions
  *
  * @param string $type
  *
  * @return void
  */
 protected function displayActionIndex($type = 'Check')
 {
     $this->messageBus->headerMessage('Avaliable ' . $type . 's:', 'info');
     $type = strtolower($type);
     if ($this->availableActions === array()) {
         $this->availableActions = $this->commandManager->getAvailableCommands();
     }
     $colorizedIdentifierLength = $this->getMaximumIdentifierLength($this->availableActions[$type], TRUE);
     $identifierLength = $this->getMaximumIdentifierLength($this->availableActions[$type]);
     $this->messageBus->message(vsprintf('    %-' . $identifierLength . 's %s', array('Identifier', 'Description')));
     $this->messageBus->horizontalLine();
     /** @var Tx_Smoothmigration_Checks_AbstractCheckDefinition $command */
     $counter = 1;
     foreach ($this->availableActions[$type] as $command) {
         $this->autoCompleteValues['actions'][] = $command->getIdentifier();
         $description = wordwrap($command->getShortDescription(), TERMINAL_WIDTH - $identifierLength - 7, PHP_EOL . str_repeat(' ', $identifierLength + 7), TRUE);
         $shortCommandIdentifier = $command->getIdentifier();
         $this->messageBus->message(vsprintf('%2s) %-' . $colorizedIdentifierLength . 's %s', array($counter, $this->messageBus->successString($shortCommandIdentifier), $description)));
         $counter++;
     }
     $this->messageBus->message();
     if ($this->isInInteractiveMode) {
         $this->messageBus->setCompletions(array('actions' => $this->autoCompleteValues['actions'], 'extensions' => Tx_Smoothmigration_Utility_ExtensionUtility::getLoadedExtensionsFiltered()));
         $actions = $this->autoCompleteValues['actions'][$type];
         $this->messageBus->usage();
         $response = $this->messageBus->prompt();
         $this->messageBus->message();
         list($code, $extension) = explode(' ', $response);
         if (array_key_exists($code, $actions)) {
             readline_add_history($response);
             $method = $type . 'Command';
             $this->{$method}($actions[$code], $extension);
         } elseif (in_array($code, $actions)) {
             readline_add_history($response);
             $method = $type . 'Command';
             $this->{$method}($code, $extension);
         } elseif ($code == -1) {
             $this->interactiveCommand();
         } else {
             $this->messageBus->errorMessage('Uknown comand: ' . $code);
             $this->interactiveCommand();
         }
     } else {
         $this->messageBus->message('Usage: ./cli_dispatch.phpsh extbase smoothmigration:' . $type . ' <Identifier> [extensionName]');
     }
     $this->messageBus->message();
 }
コード例 #2
0
 /**
  * Execute all checks
  *
  * @return void
  */
 private function executeAllChecks()
 {
     $issues = 0;
     $registry = Tx_Smoothmigration_Service_Check_Registry::getInstance();
     $checks = $registry->getActiveChecks();
     /** @var Tx_Smoothmigration_Domain_Interface_Check $singleCheck */
     foreach ($checks as $singleCheck) {
         $processor = $singleCheck->getProcessor();
         $this->messageBus->headerMessage('Check: ' . $singleCheck->getTitle(), 'info');
         $processor->execute();
         foreach ($processor->getIssues() as $issue) {
             $this->issueRepository->add($issue);
         }
         $issues = $issues + count($processor->getIssues());
         $this->messageBus->infoMessage(count($processor->getIssues()) . ' issues found');
     }
     $persistenceManger = $this->objectManager->get('Tx_Extbase_Persistence_Manager');
     $persistenceManger->persistAll();
     $this->messageBus->infoMessage(LF . 'Total Issues : ' . $issues);
 }