UserActivator::send()   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 2
1
<?php namespace Anomaly\UsersModule\User;
2
3
use Anomaly\UsersModule\User\Command\ActivateUserByCode;
4
use Anomaly\UsersModule\User\Command\ActivateUserByForce;
5
use Anomaly\UsersModule\User\Command\SendActivationEmail;
6
use Anomaly\UsersModule\User\Command\StartUserActivation;
7
use Anomaly\UsersModule\User\Contract\UserInterface;
8
use Illuminate\Foundation\Bus\DispatchesJobs;
9
10
class UserActivator
11
{
12
    use DispatchesJobs;
13
14
    /**
15
     * Start a user activation process.
16
     *
17
     * @param  UserInterface $user
18
     * @return bool
19
     */
20
    public function start(UserInterface $user)
21
    {
22
        return $this->dispatch(new StartUserActivation($user));
23
    }
24
25
    /**
26
     * Activate a user by code.
27
     *
28
     * @param  UserInterface $user
29
     * @param                $code
30
     * @return bool
31
     */
32
    public function activate(UserInterface $user, $code)
33
    {
34
        return $this->dispatch(new ActivateUserByCode($user, $code));
35
    }
36
37
    /**
38
     * Activate a user by force.
39
     *
40
     * @param  UserInterface $user
41
     * @return bool
42
     */
43
    public function force(UserInterface $user)
44
    {
45
        return $this->dispatch(new ActivateUserByForce($user));
46
    }
47
48
    /**
49
     * Send an activation email.
50
     *
51
     * @param  UserInterface $user
52
     * @param  string        $redirect
53
     * @return bool
54
     */
55
    public function send(UserInterface $user, $redirect = '/')
56
    {
57
        return $this->dispatch(new SendActivationEmail($user, $redirect));
58
    }
59
}
60