result = $result; $this->returnCode = $return_code; $this->stdout = $stdout; $this->stderr = $stderr; $this->signal = $signal; return $this; } /** * @param string $error * @return $this */ public function setError(string $error): JobResult { $this->result = Job::RESULT_FAIL; $this->stderr = $error; return $this; } /** * @return bool */ public function isFailed(): bool { return $this->result == Job::RESULT_FAIL; } /** * @return string */ public function getStdout(): string { return $this->stdout; } /** * @return mixed|null */ public function getStdoutAsJSON() { $json = jsonDecode($this->stdout); return $json ? $json : null; } /** * @return string */ public function getError(): string { return $this->stderr ?? ''; } }