path = $path; } public function getPath(): ?string { return $this->path; } public function getMessageWithPath(): string { return sprintf( 'Cannot process media file at path "%s": %s', $this->path, $this->message ); } public static function forPath(string $path, string $error = 'General Error'): self { $exception = new self($error); $exception->setPath(basename($path)); return $exception; } }