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