From 81813b5ad3d1579260c56f3da99b2509f66a4928 Mon Sep 17 00:00:00 2001 From: jtfnetoo Date: Wed, 1 Feb 2023 14:28:50 -0400 Subject: [PATCH] =?UTF-8?q?Refatorando=20fun=C3=A7=C3=B5es=20inline=20e=20?= =?UTF-8?q?download=20para=20fazer=20o=20print?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JasperServerRequestServiceContract.php | 8 ++++---- src/app/Services/JasperServerRequestService.php | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/app/Services/Contracts/JasperServerRequestServiceContract.php b/src/app/Services/Contracts/JasperServerRequestServiceContract.php index 8884e1a..38e30b6 100644 --- a/src/app/Services/Contracts/JasperServerRequestServiceContract.php +++ b/src/app/Services/Contracts/JasperServerRequestServiceContract.php @@ -85,13 +85,13 @@ interface JasperServerRequestServiceContract public function call(string $uri): JasperServerRequestService; /** - * @return string + * @return void */ - public function inline(): string; + public function inline(): void; /** * @param string|null $filename - * @return string + * @return void */ - public function download(?string $filename): string; + public function download(?string $filename): void; } diff --git a/src/app/Services/JasperServerRequestService.php b/src/app/Services/JasperServerRequestService.php index d7120b6..bc784f2 100644 --- a/src/app/Services/JasperServerRequestService.php +++ b/src/app/Services/JasperServerRequestService.php @@ -230,26 +230,27 @@ class JasperServerRequestService implements JasperServerRequestServiceContract } /** - * @return string + * @return void */ - public function inline(): string + public function inline(): void { $this->setContentDisposition(ContentDispositionEnum::INLINE); - return $this->getReport(); + $this->setHeader($this->report); + echo $this->getReport(); } /** * @param string|null $filename - * @return string + * @return void */ - public function download(?string $filename): string + public function download(?string $filename): void { if (in_array($this->format, ReportFormatEnum::downloadable())) { $this->setContentDisposition(ContentDispositionEnum::ATTACHMENT); $this->setHeader($this->report, $filename); } - return $this->getReport(); + echo $this->getReport(); } /**