| Conditions | 5 |
| Paths | 5 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 50 | 8 | public function beforeSave($insert) |
|
| 51 | { |
||
| 52 | 8 | if (parent::beforeSave($insert)) { |
|
| 53 | 8 | if ($insert) { |
|
| 54 | 8 | if (!Yii::$app instanceof \yii\console\Application) { |
|
| 55 | $this->user_id = Yii::$app->user->isGuest ? 0 : Yii::$app->user->id; // @codeCoverageIgnore |
||
| 56 | $this->ip = ip2long(Yii::$app->request->getUserIP()); // @codeCoverageIgnore |
||
| 57 | } // @codeCoverageIgnore |
||
| 58 | } |
||
| 59 | 8 | return true; |
|
| 60 | } |
||
| 61 | return false; // @codeCoverageIgnore |
||
| 62 | } |
||
| 63 | |||
| 76 |