UserPassword::forgot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php namespace Anomaly\UsersModule\User;
2
3
use Anomaly\UsersModule\User\Contract\UserInterface;
4
use Anomaly\UsersModule\User\Password\Command\ResetPassword;
5
use Anomaly\UsersModule\User\Password\Command\SendResetEmail;
6
use Anomaly\UsersModule\User\Password\Command\StartPasswordReset;
7
use Illuminate\Foundation\Bus\DispatchesJobs;
8
9
/**
10
 * Class UserPassword
11
 *
12
 * @link          http://pyrocms.com/
13
 * @author        PyroCMS, Inc. <[email protected]>
14
 * @author        Ryan Thompson <[email protected]>
15
 */
16
class UserPassword
17
{
18
19
    use DispatchesJobs;
20
21
    /**
22
     * Start a password reset.
23
     *
24
     * @param  UserInterface $user
25
     * @return bool
26
     */
27
    public function forgot(UserInterface $user)
28
    {
29
        return $this->dispatch(new StartPasswordReset($user));
30
    }
31
32
    /**
33
     * Reset a user's password.
34
     *
35
     * @param  UserInterface $user
36
     * @param                $code
37
     * @param                $password
38
     * @return bool
39
     */
40
    public function reset(UserInterface $user, $code, $password)
41
    {
42
        return $this->dispatch(new ResetPassword($user, $code, $password));
43
    }
44
45
    /**
46
     * @param  UserInterface $user
47
     * @param  string        $reset
48
     * @return bool
49
     */
50
    public function send(UserInterface $user, $reset = '/')
51
    {
52
        return $this->dispatch(new SendResetEmail($user, $reset));
53
    }
54
}
55