GameMoveCommand::getMove()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace MiniGameApp\Command;
4
5
use MiniGame\Entity\MiniGameId;
6
use MiniGame\Entity\PlayerId;
7
use MiniGame\Move;
8
use RemiSan\Context\Context;
9
10
class GameMoveCommand extends AbstractPlayerCommand
11
{
12
    const NAME = 'GAME.MOVE';
13
14
    /**
15
     * @var Move
16
     */
17
    private $move;
18
19
    /**
20
     * Constructor.
21
     */
22 12
    public function __construct()
23
    {
24 12
    }
25
26
    /**
27
     * Returns the command name
28
     *
29
     * @return string
30
     */
31 3
    public function getCommandName()
32
    {
33 3
        return self::NAME;
34
    }
35
36
    /**
37
     * @return Move
38
     */
39 9
    public function getMove()
40
    {
41 9
        return $this->move;
42
    }
43
44
    /**
45
     * Static constructor.
46
     *
47
     * @param MiniGameId $gameId
48
     * @param PlayerId   $playerId
49
     * @param Move       $move
50
     * @param Context    $origin
51
     *
52
     * @return GameMoveCommand
53
     */
54 12
    public static function create(
55
        MiniGameId $gameId,
56
        PlayerId $playerId,
57
        Move $move,
58
        Context $origin = null
59
    ) {
60 12
        $obj = new self();
61
62 12
        $obj->init($gameId, $playerId, $origin);
63
64 12
        $obj->move = $move;
65
66 12
        return $obj;
67
    }
68
}
69