StartUserActivation   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 33
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 6 1
1
<?php namespace Anomaly\UsersModule\User\Command;
2
3
use Anomaly\UsersModule\User\Contract\UserInterface;
4
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
5
6
7
/**
8
 * Class StartUserActivation
9
 *
10
 * @link          http://pyrocms.com/
11
 * @author        PyroCMS, Inc. <[email protected]>
12
 * @author        Ryan Thompson <[email protected]>
13
 */
14
class StartUserActivation
15
{
16
17
    /**
18
     * The user instance.
19
     *
20
     * @var UserInterface
21
     */
22
    protected $user;
23
24
    /**
25
     * Create a new StartUserActivation instance.
26
     *
27
     * @param UserInterface $user
28
     */
29
    function __construct(UserInterface $user)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
30
    {
31
        $this->user = $user;
32
    }
33
34
    /**
35
     * Handle the command.
36
     *
37
     * @param  UserRepositoryInterface $users
38
     * @return bool
39
     */
40
    public function handle(UserRepositoryInterface $users)
41
    {
42
        $users->save($this->user->setAttribute('activation_code', str_random(40)));
43
44
        return true;
45
    }
46
}
47