/** * {@inheritdoc} */ public function run() { $callchain = ''; foreach ($this->stack as $action) { $command = array_shift($action); $parameters = $this->formatParameters($action); $callchain .= "\n ->{$command}(<fg=green>{$parameters}</>)"; } $context = $this->getTaskContext(['_level' => RoboLogLevel::SIMULATED_ACTION, 'simulated' => TaskInfo::formatTaskName($this->task), 'parameters' => $this->formatParameters($this->constructorParameters), '_style' => ['simulated' => 'fg=blue;options=bold']]); // RoboLogLevel::SIMULATED_ACTION $this->printTaskInfo("Simulating {simulated}({parameters}){$callchain}", $context); $result = null; if ($this->task instanceof SimulatedInterface) { $result = $this->task->simulate($context); } if (!isset($result)) { $result = Result::success($this); } return $result; }
/** * Get the formatted task name for use in task output. * This is placed in the task context under 'name', and * used as the log label by Robo\Common\RoboLogStyle, * which is inserted at the head of log messages by * Robo\Common\CustomLogStyle::formatMessage(). * * @param null|object $task * * @return string */ protected function getPrintedTaskName($task = null) { if (!$task) { $task = $this; } return TaskInfo::formatTaskName($task); }