LeaveGameCommand::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 3
crap 1
1
<?php
2
3
namespace MiniGameApp\Command;
4
5
use MiniGame\Entity\MiniGameId;
6
use MiniGame\Entity\PlayerId;
7
use RemiSan\Context\Context;
8
9
class LeaveGameCommand extends AbstractPlayerCommand
10
{
11
    const NAME = 'GAME.LEAVE';
12
13
    /**
14
     * Construct.
15
     */
16 9
    public function __construct()
17
    {
18 9
    }
19
20
    /**
21
     * Returns the command name
22
     *
23
     * @return string
24
     */
25 3
    public function getCommandName()
26
    {
27 3
        return self::NAME;
28
    }
29
30
    /**
31
     * Construct
32
     *
33
     * @param MiniGameId  $id
34
     * @param PlayerId    $playerId
35
     * @param Context      $origin
36
     *
37
     * @return LeaveGameCommand
38
     */
39 9
    public static function create(
40
        MiniGameId $id,
41
        PlayerId $playerId,
42
        Context $origin = null
43
    ) {
44 9
        $obj = new self();
45
46 9
        $obj->init($id, $playerId, $origin);
47
48 9
        return $obj;
49
    }
50
}
51