/** * @param \Robo\Contract\TaskInterface $task * @param string $exitCode * @param string $message * @param array $data */ public function __construct(TaskInterface $task, $exitCode, $message = '', $data = []) { parent::__construct($exitCode, $message, $data); $this->task = $task; $this->printResult(); if (self::$stopOnFail) { $this->stopOnFail(); } }
/** * Demonstrate Robo formatters. Default format is 'table'. * * @field-labels * first: I * second: II * third: III * @usage try:formatters --format=yaml * @usage try:formatters --format=csv * @usage try:formatters --fields=first,third * @usage try:formatters --fields=III,II */ public function tryFormatters($options = ['format' => 'table', 'fields' => '']) { $outputData = [['first' => 'One', 'second' => 'Two', 'third' => 'Three'], ['first' => 'Eins', 'second' => 'Zwei', 'third' => 'Drei'], ['first' => 'Ichi', 'second' => 'Ni', 'third' => 'San'], ['first' => 'Uno', 'second' => 'Dos', 'third' => 'Tres']]; // Note that we can also simply return the output data array here. return ResultData::message(new RowsOfFields($outputData)); }
/** * Merge another result into this result. Data already * existing in this result takes precedence over the * data in the Result being merged. */ public function merge(ResultData $result) { $mergedData = $this->getArrayCopy() + $result->getArrayCopy(); $this->exchangeArray($mergedData); return $this; }