exitCode = $exitCode; $this->message = $message; parent::__construct($data); } /** * @param string $message * @param array $data * * @return \Robo\ResultData */ public static function message($message, $data = []) { return new self(self::EXITCODE_OK, $message, $data); } /** * @param string $message * @param array $data * * @return \Robo\ResultData */ public static function cancelled($message = '', $data = []) { return new ResultData(self::EXITCODE_USER_CANCEL, $message, $data); } /** * @return array */ public function getData() { return $this->getArrayCopy(); } /** * @return int */ public function getExitCode() { return $this->exitCode; } /** * @return null|string */ public function getOutputData() { if (!empty($this->message) && !isset($this['already-printed'])) { return $this->message; } } /** * @return string */ public function getMessage() { return $this->message; } /** * @return bool */ public function wasSuccessful() { return $this->exitCode === self::EXITCODE_OK; } /** * @return bool */ public function wasCancelled() { return $this->exitCode == self::EXITCODE_USER_CANCEL; } /** * Merge another result into this result. Data already * existing in this result takes precedence over the * data in the Result being merged. * * @param \Robo\ResultData $result * * @return $this */ public function merge(ResultData $result) { $mergedData = $this->getArrayCopy() + $result->getArrayCopy(); $this->exchangeArray($mergedData); return $this; } /** * @return bool */ public function hasExecutionTime() { return isset($this['time']); } /** * @return null|float */ public function getExecutionTime() { if (!$this->hasExecutionTime()) { return null; } return $this['time']; } }