Optimize PHPStreamer (closes #708)

This commit is contained in:
Phan An 2018-04-14 22:46:08 +02:00
parent cdf9faafbf
commit e11e9d1392

View file

@ -46,12 +46,17 @@ class PHPStreamer extends Streamer implements StreamerInterface
if ($range[0] === '') {
// First number missing, return last $range[1] bytes
$end = $fileSize - 1;
$start = $end - (int) $range[0];
$start = $end = $fileSize - 1;
} elseif ($range[1] === '') {
// Second number missing, return from byte $range[0] to end
$start = (int) $range[0];
$end = $fileSize - 1;
if ($range[0] === 0) {
$start = 0;
$end = $fileSize - 1;
$partial = false;
} else {
// Second number missing, return from byte $range[0] to end
$start = (int) $range[0];
$end = $fileSize - 1;
}
} else {
// Both numbers present, return specific range
$start = (int) $range[0];