message = $message; $this->file = $file; $this->line = $line; $this->throwable = $throwable; } public function asString(): string { $output = $this->message; if ($this->getFile() !== null) { $output .= sprintf(' in file "%s"', $this->file); if ($this->line !== null) { $output .= sprintf(' at line %d', $this->line); } } return $output; } public function getMessage(): string { return $this->message; } public function getFile(): ?string { if ($this->file === '') { return null; } return $this->file; } public function getLine(): ?int { return $this->line; } public function getThrowable(): ?Throwable { return $this->throwable; } }