job = $job; $this->body = $body; $this->error = $error; $this->hasScreenshot = $hasScreenshot; } private function constructString(bool $inMarkdown = false) { $mdBody = ""; if ($this->body !== null) { $mdBody .= $this->body; } if ($this->error !== null) { $errorWrapper = $inMarkdown ? "```" : ""; $mdBody .= " :\n" . $errorWrapper . $this->error . $errorWrapper; } if ($inMarkdown && $this->hasScreenshot) { $mdBody .= "\nScreenshot : "; } return $mdBody; } /** * @inheritDoc */ public function toMarkdownString(): string { return $this->constructString(true); } /** * @inheritDoc */ public function toString(): string { return $this->constructString(); } }