JoinGameCommand::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

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