Total Complexity | 4 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
13 | class Router |
||
14 | { |
||
15 | public const JOIN = 0xC1; |
||
16 | public const LEAVE = 0xC2; |
||
17 | |||
18 | /** |
||
19 | * @var int |
||
20 | */ |
||
21 | private $cmd = null; |
||
22 | |||
23 | /** |
||
24 | * @var Endpoint |
||
25 | */ |
||
26 | private $endpoint = null; |
||
27 | |||
28 | /** |
||
29 | * Router constructor. |
||
30 | * @param int $cmd |
||
31 | * @param Endpoint $endpoint |
||
32 | */ |
||
33 | public function __construct(int $cmd, Endpoint $endpoint) |
||
34 | { |
||
35 | $this->cmd = $cmd; |
||
36 | $this->endpoint = $endpoint; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @return bool |
||
41 | */ |
||
42 | public function joined() : bool |
||
43 | { |
||
44 | return $this->cmd === self::JOIN; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @return bool |
||
49 | */ |
||
50 | public function leaved() : bool |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return Endpoint |
||
57 | */ |
||
58 | public function target() : Endpoint |
||
61 | } |
||
62 | } |
||
63 |