ResetPasswordEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
/*
4
 * This file is part of the 2amigos/yii2-usuario project.
5
 *
6
 * (c) 2amigOS! <http://2amigos.us/>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace Da\User\Event;
13
14
use Da\User\Form\RecoveryForm;
15
use Da\User\Model\Token;
16
use yii\base\Event;
17
18
/**
19
 * @property-read Token $token
20
 * @property-read RecoveryForm $form
21
 */
22
class ResetPasswordEvent extends Event
23
{
24
    const EVENT_BEFORE_TOKEN_VALIDATE = 'beforeTokenValidate';
25
    const EVENT_AFTER_TOKEN_VALIDATE = 'afterTokenValidate';
26
    const EVENT_BEFORE_RESET = 'beforeReset';
27
    const EVENT_AFTER_RESET = 'afterReset';
28
29
    protected $form;
30
    protected $token;
31
32 1
    public function __construct(Token $token = null, RecoveryForm $form = null, array $config = [])
33
    {
34 1
        $this->form = $form;
35 1
        $this->token = $token;
36
37 1
        parent::__construct($config);
38 1
    }
39
40
    public function getForm()
41
    {
42
        return $this->form;
43
    }
44
45 1
    public function getToken()
46
    {
47 1
        return $this->token;
48
    }
49
50 1
    public function updateForm(RecoveryForm $form)
51
    {
52 1
        return new static($this->getToken(), $form);
53
    }
54
}
55