| Conditions | 5 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function init() |
||
| 22 | { |
||
| 23 | parent::init(); |
||
| 24 | |||
| 25 | if ($this->compress === true) { |
||
| 26 | \Yii::$app->response->on(\yii\web\Response::EVENT_BEFORE_SEND, function (\yii\base\Event $Event) { |
||
| 27 | $Response = $Event->sender; |
||
| 28 | if ($Response->format === \yii\web\Response::FORMAT_HTML) { |
||
| 29 | if (!empty($Response->data)) { |
||
| 30 | $Response->data = self::compress($Response->data); |
||
| 31 | } |
||
| 32 | if (!empty($Response->content)) { |
||
| 33 | $Response->content = self::compress($Response->content); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | }); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 68 |