Example #1
0
File: Timer.php Project: jjok/Robo
 /**
  * @return float|null
  */
 protected function getExecutionTime()
 {
     if (!isset($this->timer)) {
         return null;
     }
     return $this->timer->elapsed();
 }
Example #2
0
 /**
  * Log style customization for Robo: add the time indicator to the
  * end of the log message if it exists in the context.
  */
 protected function formatMessage($label, $message, $context, $taskNameStyle, $messageStyle = '')
 {
     $message = parent::formatMessage($label, $message, $context, $taskNameStyle, $messageStyle);
     if (array_key_exists('time', $context) && !empty($context['time']) && array_key_exists('timer-label', $context)) {
         $duration = TimeKeeper::formatDuration($context['time']);
         $message .= ' ' . $context['timer-label'] . ' ' . $this->wrapFormatString($duration, 'fg=yellow');
     }
     return $message;
 }