Deployer\Executor\Informer::endTask PHP Method

endTask() public method

Print task was ok.
public endTask ( )
    public function endTask()
    {
        $shouldReplaceTaskMark = $this->output->isDecorated() && $this->output->getVerbosity() == OutputInterface::VERBOSITY_NORMAL && !$this->output->getWasWritten();
        if ($shouldReplaceTaskMark) {
            $this->output->writeln("\r\r<info>✔</info>");
        } else {
            if ($this->output->getVerbosity() == OutputInterface::VERBOSITY_NORMAL) {
                $this->output->writeln("<info>✔</info> Ok");
            } else {
                $endTime = round(microtime(true) * 1000);
                $millis = $endTime - $this->startTime;
                $seconds = floor($millis / 1000);
                $millis = $millis - $seconds * 1000;
                $taskTime = ($seconds > 0 ? "{$seconds}s " : "") . "{$millis}ms";
                $this->output->writeln("<info>✔</info> Ok [{$taskTime}]");
            }
        }
    }

Usage Example

Example #1
0
 /**
  * {@inheritdoc}
  */
 public function run($tasks, $servers, $environments, $input, $output)
 {
     $output = new OutputWatcher($output);
     $informer = new Informer($output);
     foreach ($tasks as $task) {
         $success = true;
         $informer->startTask($task->getName());
         if ($task->isOnce()) {
             $task->run(new Context(null, null, $input, $output));
         } else {
             foreach ($servers as $serverName => $server) {
                 if ($task->runOnServer($serverName)) {
                     $env = isset($environments[$serverName]) ? $environments[$serverName] : ($environments[$serverName] = new Environment());
                     $informer->onServer($serverName);
                     try {
                         $task->run(new Context($server, $env, $input, $output));
                     } catch (NonFatalException $exception) {
                         $success = false;
                         $informer->taskException($serverName, 'Deployer\\Task\\NonFatalException', $exception->getMessage());
                     }
                     $informer->endOnServer($serverName);
                 }
             }
         }
         if ($success) {
             $informer->endTask();
         } else {
             $informer->taskError();
         }
     }
 }
All Usage Examples Of Deployer\Executor\Informer::endTask