Conditions | 3 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
30 | public function getStreamedFileFunction($file) |
||
31 | { |
||
32 | return function() use ($file) { |
||
33 | set_time_limit(0); |
||
34 | $handle = fopen($file, 'rb'); |
||
35 | if ($handle !== false) { |
||
36 | $chunkSize = 1024 * 1024; |
||
37 | while (!feof($handle)) { |
||
38 | $buffer = fread($handle, $chunkSize); |
||
39 | echo $buffer; |
||
40 | flush(); |
||
41 | } |
||
42 | fclose($handle); |
||
43 | } |
||
44 | }; |
||
45 | } |
||
46 | |||
48 |