Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
45 | public function belongsToUserAndIsNotExpired($attribute, $params) |
||
46 | { |
||
47 | if (!$this->hasErrors()) { |
||
48 | $code = Code::find()->where([ |
||
49 | 'hash' => hash('sha256', $this->activation_code . '_activation_token') |
||
50 | ])->one(); |
||
51 | |||
52 | if ($code === null) { |
||
53 | $this->addError('activation_code', Yii::t('yrc', 'The activation code provided is not valid.')); |
||
54 | return; |
||
55 | } |
||
56 | |||
57 | $this->user = Yii::$app->yrc->userClass::find()->where(['id' => $code->user_id])->one(); |
||
58 | |||
59 | if ($this->user === null) { |
||
60 | $this->addError('activation_code', Yii::t('yrc', 'The activation code provided is not valid.')); |
||
61 | } |
||
62 | } |
||
63 | } |
||
64 | |||
82 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.