Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
joanfabregat committed Feb 24, 2024
1 parent 4bd646c commit c814c12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
class Exception extends BaseException
{
public const int ERROR_FILE_OPEN = 100;
public const int ERROR_FILE_WRITE = 110;
public const int ERROR_REQUEST = 200;
public const int ERROR_RESPONSE = 300;
}
5 changes: 4 additions & 1 deletion src/Pdf2TxtClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ public function saveStreamToFile(StreamInterface $stream, string $path, string $
throw new Exception("The file '$path' could not be opened", Exception::ERROR_FILE_OPEN);
}

stream_copy_to_stream($stream->detach(), $f);
if (stream_copy_to_stream($stream->detach(), $f) === false) {
throw new Exception("The stream could not be copied to the file '$path'", Exception::ERROR_FILE_WRITE);
}

fclose($f);
}

Expand Down

0 comments on commit c814c12

Please sign in to comment.