Completed
Push — master ( 5ee4c9...308b6a )
by Antonio
05:05
created

ResetPasswordEvent   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 33
ccs 0
cts 18
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getForm() 0 4 1
A getToken() 0 4 1
A updateForm() 0 4 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
class ResetPasswordEvent extends Event
19
{
20
    const EVENT_BEFORE_TOKEN_VALIDATE = 'beforeTokenValidate';
21
    const EVENT_AFTER_TOKEN_VALIDATE = 'afterTokenValidate';
22
    const EVENT_BEFORE_RESET = 'beforeReset';
23
    const EVENT_AFTER_RESET = 'afterReset';
24
25
    protected $form;
26
    protected $token;
27
28
    public function __construct(Token $token = null, RecoveryForm $form = null, array $config = [])
29
    {
30
        $this->form = $form;
31
        $this->token = $token;
32
33
        parent::__construct($config);
34
    }
35
36
    public function getForm()
37
    {
38
        return $this->form;
39
    }
40
41
    public function getToken()
42
    {
43
        return $this->token;
44
    }
45
46
    public function updateForm(RecoveryForm $form)
47
    {
48
        return new static($this->getToken(), $form);
49
    }
50
}
51