| Conditions | 5 |
| Paths | 5 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 50 | public function beforeSave($insert) |
||
| 51 | { |
||
| 52 | if (parent::beforeSave($insert)) { |
||
| 53 | if ($insert) { |
||
| 54 | 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 | return true; |
||
| 60 | } |
||
| 61 | return false; // @codeCoverageIgnore |
||
| 62 | } |
||
| 63 | |||
| 73 |