| Conditions | 5 |
| Paths | 8 |
| Total Lines | 24 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function sendContent() |
||
| 22 | { |
||
| 23 | if ($this->laravelResponse instanceof StreamedResponse) { |
||
| 24 | ob_start(); |
||
| 25 | $this->laravelResponse = $this->laravelResponse->sendContent(); |
||
| 26 | $content = ob_get_clean(); |
||
| 27 | } else { |
||
| 28 | $content = $this->laravelResponse->getContent(); |
||
| 29 | } |
||
| 30 | |||
| 31 | $len = strlen($content); |
||
| 32 | if ($len === 0) { |
||
| 33 | $this->swooleResponse->end(); |
||
| 34 | return; |
||
| 35 | } |
||
| 36 | |||
| 37 | if ($len > $this->chunkLimit) { |
||
| 38 | for ($offset = 0, $limit = (int)(0.6 * $this->chunkLimit); $offset < $len; $offset += $limit) { |
||
| 39 | $chunk = substr($content, $offset, $limit); |
||
| 40 | $this->swooleResponse->write($chunk); |
||
| 41 | } |
||
| 42 | $this->swooleResponse->end(); |
||
| 43 | } else { |
||
| 44 | $this->swooleResponse->end($content); |
||
| 45 | } |
||
| 47 | } |