Skip to content

Commit 943f71c

Browse files
committed
Ajuste na verificação de arquivo existe.
1 parent ee133bd commit 943f71c

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/JSignPDF.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public function __construct()
2626

2727
public function sign()
2828
{
29-
if (empty($this->pdf) || !file_exists($this->pdf))
29+
if (empty($this->pdf) || !is_file($this->pdf))
3030
throw new Exception("PDF is Empty or Invalid");
3131

32-
if (empty($this->certificate) || !file_exists($this->certificate))
32+
if (empty($this->certificate) || !is_file($this->certificate))
3333
throw new Exception("Certificate is Empty or Invalid");
3434

3535
if (empty($this->password))
@@ -128,8 +128,6 @@ private function saveCertificate($certificate)
128128
{
129129
$name = $this->baseName . ".pfx";
130130
$path = "{$this->retrievePathTemp()}{$name}";
131-
if (!file_exists($path))
132-
throw new Exception("Certificate Invalid Path.");
133131
file_put_contents($path, $certificate);
134132
if (!is_file($path))
135133
throw new Exception('Erro ao salvar arquivo do Certificado.');
@@ -140,8 +138,6 @@ private function savePdf($pdf)
140138
{
141139
$this->fileName = $this->baseName . ".pdf";
142140
$path = "{$this->retrievePathTemp()}{$this->fileName}";
143-
if (!file_exists($path))
144-
throw new Exception("PDF Invalid Path.");
145141
file_put_contents($path, $pdf);
146142
if (!is_file($path))
147143
throw new Exception('Erro ao salvar arquivo PDF.');

0 commit comments

Comments
 (0)