Skip to content

Commit e6d50e1

Browse files
committed
Add ResponseDownload::isConnectionStatusNormal method
1 parent d7a3d56 commit e6d50e1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/ResponseDownload.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ private function readBuffer(int $firstByte, int $lastByte) : void
311311
$bytesRead = $bytesLeft > $this->readLength ? $this->readLength : $bytesLeft;
312312
$bytesLeft -= $bytesRead;
313313
$this->flush($bytesRead);
314-
if (\connection_status() !== \CONNECTION_NORMAL) {
314+
if (!$this->isConnectionStatusNormal()) {
315315
break;
316316
}
317317
}
@@ -335,12 +335,17 @@ private function readFile() : void
335335
{
336336
while (!\feof($this->handle)) {
337337
$this->flush($this->readLength);
338-
if (\connection_status() !== \CONNECTION_NORMAL) {
338+
if (!$this->isConnectionStatusNormal()) {
339339
break;
340340
}
341341
}
342342
}
343343

344+
private function isConnectionStatusNormal() : bool
345+
{
346+
return \connection_status() === \CONNECTION_NORMAL;
347+
}
348+
344349
/**
345350
* Tell if Response has a downloadable file.
346351
*

0 commit comments

Comments
 (0)