コード例 #1
0
ファイル: JsonFormatter.php プロジェクト: temp/update-checker
 /**
  * {@inheritdoc}
  */
 public function displayResults(OutputStyle $style, $lockFile, array $packages, $showTaggedDev)
 {
     if (defined('JSON_PRETTY_PRINT')) {
         $style->write(json_encode($packages, JSON_PRETTY_PRINT));
     } else {
         $style->write(json_encode($packages));
     }
 }
コード例 #2
0
ファイル: Bookmark.php プロジェクト: natedrake/fast-forward
 /**
  * @param Client      $client
  * @param OutputStyle $output
  *
  * @throws \Exception
  */
 public function run($client, OutputStyle $output)
 {
     $this->hit_count++;
     $output->success("Running '" . $this->shortcut . "' for the " . $client->ordinal($this->hit_count) . ' time.');
     $command = $client->getSettings()->parseIdentifiers($this->command);
     switch (OS::getType()) {
         case OS::LINUX:
             $output->writeln('cmd:' . $command);
             break;
         case OS::WINDOWS:
             file_put_contents($client->getBatchPath(), $command);
             break;
     }
     $this->save();
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function displayResults(OutputStyle $style, $lockFile, array $data, $showTaggedDev)
 {
     $style->text("Checked file: <fg=yellow>{$lockFile}</>");
     $style->newLine();
     $headers = array('Name', 'Local', 'Stable');
     $rows = array();
     if ($showTaggedDev) {
         $headers[] = 'Dev';
     }
     $errors = array();
     foreach ($data as $name => $status) {
         if ($style->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE && !$status['stableStatus'] && (!$showTaggedDev || !$status['devStatus'])) {
             continue;
         }
         $row = array($status['name'], $this->tag($status['localVersion'], $status['localStatus']), $this->tag($status['stableVersion'], $status['stableStatus']));
         if ($showTaggedDev) {
             $row[] = $this->tag($status['devVersion'], $status['devStatus']);
         }
         $rows[] = $row;
     }
     if (count($errors)) {
         $style->error(implode(PHP_EOL, $errors));
     }
     if (count($rows)) {
         $style->table($headers, $rows);
     } else {
         $style->success('No outdated packages found.');
     }
 }
コード例 #4
0
ファイル: cli_iohandler.php プロジェクト: MrAdder/phpbb
 /**
  * {@inheritdoc}
  */
 public function set_task_count($task_count, $restart = false)
 {
     parent::set_task_count($task_count, $restart);
     if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
         $this->progress_bar = $this->io->createProgressBar($task_count);
         $this->progress_bar->setFormat("    %current:3s%/%max:-3s% %bar%  %percent:3s%%\n" . "             %message%\n");
         $this->progress_bar->setBarWidth(60);
         if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
             $this->progress_bar->setEmptyBarCharacter('░');
             // light shade character \u2591
             $this->progress_bar->setProgressCharacter('');
             $this->progress_bar->setBarCharacter('▓');
             // dark shade character \u2593
         }
         $this->progress_bar->setMessage('');
         $this->io->newLine(2);
         $this->progress_bar->start();
     }
 }
コード例 #5
0
ファイル: Migration.php プロジェクト: natedrake/fast-forward
 /**
  * Initial setup of an empty database
  *
  * @return bool True when a migration happened
  *
  * @throws \Exception
  */
 private function fromBlank()
 {
     $this->out->note('No database found. Setting up a fresh one.');
     $setupStatements = $this->getBlankStatements();
     $this->out->progressStart(count($setupStatements));
     foreach ($setupStatements as $key => $singleSql) {
         $singleSql = trim($singleSql);
         try {
             $statement = DBA::prepare($singleSql);
             $statement->execute();
         } catch (\PDOException $e) {
             $msg = 'SQL error: ' . $e->getMessage() . "\nWhile trying to execute:\n{$singleSql}";
             throw new \Exception($msg);
         }
         $this->out->progressAdvance();
     }
     $this->out->progressFinish();
     return true;
 }
コード例 #6
0
ファイル: SymfonyStyle.php プロジェクト: a53ali/CakePhP
 /**
  * {@inheritdoc}
  */
 public function newLine($count = 1)
 {
     parent::newLine($count);
     $this->bufferedOutput->write(str_repeat("\n", $count));
 }
コード例 #7
0
 /**
  * Display command error note.
  *
  * @param OutputStyle $outputStyle
  * @return FetchCommand $this Fluent interface.
  */
 protected function displayCommandError(OutputStyle $outputStyle)
 {
     $outputStyle->error('Unable to fetch data from source(s). See log for details.');
     return $this;
 }
コード例 #8
0
 /**
  * Interacts with the user to retrieve task configurations.
  *
  * @param OutputStyle $io
  */
 private function interactForTaskConfigurations(OutputStyle $io)
 {
     $io->writeln(' Add tasks:');
     $addTask = true;
     while ($addTask) {
         $taskQuestion = new Question('Search for a task');
         $taskQuestion->setAutocompleterValues($this->getAvailableTasks());
         $taskQuestion->setValidator(function ($answer) {
             if (class_exists($answer) === false && class_exists('Accompli\\Task\\' . $answer) === true) {
                 $answer = 'Accompli\\Task\\' . $answer;
             }
             if (class_exists($answer) === false || in_array(TaskInterface::class, class_implements($answer)) === false) {
                 throw new InvalidArgumentException(sprintf('The task "%s" does not exist.', $answer));
             }
             return $answer;
         });
         $task = $io->askQuestion($taskQuestion);
         $taskConfiguration = array_merge(array('class' => $task), $this->getTaskConfigurationParameters($task));
         $this->configuration['events']['subscribers'][] = $taskConfiguration;
         $addTask = $io->confirm('Add another task?');
     }
 }
コード例 #9
0
 /**
  * {@inheritdoc}
  */
 public function createProgressBar($max = 0)
 {
     $progressBar = parent::createProgressBar($max);
     if ('\\' === DIRECTORY_SEPARATOR) {
         $progressBar->setEmptyBarCharacter('░');
         // light shade character \u2591
         $progressBar->setProgressCharacter('');
         $progressBar->setBarCharacter('▓');
         // dark shade character \u2593
     }
     return $progressBar;
 }
コード例 #10
0
ファイル: SymfonyStyle.php プロジェクト: edwardricardo/zenska
 /**
  * {@inheritdoc}
  */
 public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
 {
     parent::write($messages, $newline, $type);
     $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
 }
コード例 #11
0
 public function onTeardown()
 {
     $this->io->success('Teardown complete');
 }
コード例 #12
0
 /**
  * Display new line.
  *
  * @param OutputStyle $outputStyle Console output style.
  * @return ConfigurationDebugCommand $this
  */
 protected function displayNewLine(OutputStyle $outputStyle)
 {
     $outputStyle->newLine();
     return $this;
 }