Completed
Push — master ( f73742...036bd7 )
by Rémi
06:20
created

CreateGameCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 6
Bugs 1 Features 0
Metric Value
wmc 4
c 6
b 1
f 0
lcom 1
cbo 1
dl 0
loc 58
ccs 8
cts 8
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getCommandName() 0 4 1
A getOptions() 0 4 1
A create() 0 13 1
1
<?php
2
3
namespace MiniGameApp\Command;
4
5
use MiniGame\Entity\MiniGameId;
6
use MiniGame\Entity\PlayerId;
7
use MiniGame\GameOptions;
8
use RemiSan\Context\Context;
9
10
class CreateGameCommand extends AbstractPlayerCommand
11
{
12
    const NAME = 'GAME.CREATE';
13
14
    /**
15
     * @var GameOptions
16
     */
17
    private $options;
18
19
    /**
20
     * Construct.
21
     */
22
    public function __construct()
23
    {
24
    }
25
26
    /**
27 3
     * Returns the command name
28
     *
29 3
     * @return string
30
     */
31
    public function getCommandName()
32
    {
33
        return self::NAME;
34
    }
35
36 3
    /**
37
     * @return GameOptions
38 3
     */
39
    public function getOptions()
40
    {
41
        return $this->options;
42
    }
43
44 3
    /**
45
     * Construct
46 3
     *
47
     * @param MiniGameId  $id
48
     * @param PlayerId    $playerId
49
     * @param GameOptions $options
50
     * @param Context     $origin
51
     *
52 3
     * @return CreateGameCommand
53
     */
54 3
    public static function create(
55
        MiniGameId $id,
56
        PlayerId $playerId,
57
        GameOptions $options = null,
58
        Context $origin = null
59
    ) {
60
        $obj = new self();
61
62
        $obj->init($id, $playerId, $origin);
63
        $obj->options = $options;
64
65
        return $obj;
66
    }
67
}
68