Conditions | 5 |
Paths | 4 |
Total Lines | 27 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 5.0592 |
Changes | 0 |
1 | <?php |
||
38 | 6 | public function sendContent() |
|
39 | { |
||
40 | 6 | if (!$this->isSuccessful()) { |
|
41 | return parent::sendContent(); |
||
42 | } |
||
43 | |||
44 | 6 | if (0 === $this->maxlen) { |
|
45 | return $this; |
||
46 | } |
||
47 | |||
48 | 6 | $out = fopen('php://output', 'wb'); |
|
49 | |||
50 | // Create a temporary file stream with the decrypted contents. |
||
51 | 6 | $file = tmpfile(); |
|
52 | 6 | fwrite($file, $this->file->getContents()); |
|
|
|||
53 | 6 | fseek($file, 0); |
|
54 | |||
55 | 6 | stream_copy_to_stream($file, $out, $this->maxlen, $this->offset); |
|
56 | |||
57 | 6 | fclose($out); |
|
58 | 6 | fclose($file); |
|
59 | |||
60 | 6 | if ($this->deleteFileAfterSend && file_exists($this->file->getPathname())) { |
|
61 | 3 | unlink($this->file->getPathname()); |
|
62 | } |
||
63 | |||
64 | 6 | return $this; |
|
65 | } |
||
67 |