Completed
Push — master ( 2a94c4...b12f66 )
by Rémi
03:28
created

CreateUserCommand   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 0 Features 1
Metric Value
wmc 6
c 5
b 0
f 1
lcom 1
cbo 0
dl 0
loc 84
ccs 16
cts 16
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getCommandName() 0 4 1
A getOriginalUser() 0 4 1
A getPreferredLanguage() 0 4 1
A getContext() 0 4 1
A create() 0 10 1
1
<?php
2
3
namespace MessageApp\Command;
4
5
use League\Tactician\Plugins\NamedCommand\NamedCommand;
6
use RemiSan\Context\Context;
7
use RemiSan\Context\ContextAware;
8
9
class CreateUserCommand implements NamedCommand, ContextAware
10
{
11
    const NAME = 'USER.CREATE';
12
13
    /**
14
     * @var object
15
     */
16
    private $originalUser;
17
18
    /**
19
     * @var string
20
     */
21
    private $preferredLanguage;
22
23
    /**
24
     * @var Context
25
     */
26
    private $context;
27
28
    /**
29
     * Constructor.
30
     */
31 3
    public function __construct()
32
    {
33 3
    }
34
35
    /**
36
     * Returns the command name
37
     *
38
     * @return string
39
     */
40 3
    public function getCommandName()
41
    {
42 3
        return self::NAME;
43
    }
44
45
    /**
46
     * Returns the user
47
     *
48
     * @return object
49
     */
50 3
    public function getOriginalUser()
51
    {
52 3
        return $this->originalUser;
53
    }
54
55
    /**
56
     * @return string
57
     */
58 3
    public function getPreferredLanguage()
59
    {
60 3
        return $this->preferredLanguage;
61
    }
62
63
    /**
64
     * Returns the context
65
     *
66
     * @return Context
67
     */
68 3
    public function getContext()
69
    {
70 3
        return $this->context;
71
    }
72
73
    /**
74
     * Static constructor.
75
     *
76
     * @param object  $originalUser
77
     * @param string  $preferredLanguage
78
     * @param Context $context
79
     *
80
     * @return CreateUserCommand
81
     */
82 3
    public static function create($originalUser, $preferredLanguage, Context $context = null)
83
    {
84 3
        $obj = new self();
85
86 3
        $obj->originalUser = $originalUser;
87 3
        $obj->preferredLanguage = $preferredLanguage;
88 3
        $obj->context = $context;
89
90 3
        return $obj;
91
    }
92
}
93