Changed::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 2
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
/**
3
 * Routing changed
4
 * User: moyo
5
 * Date: 2018/11/22
6
 * Time: 4:48 PM
7
 */
8
9
namespace Carno\Net\Routing;
10
11
use Carno\Net\Endpoint;
12
13
class Changed
14
{
15
    /**
16
     * @var int
17
     */
18
    private $evs = null;
19
20
    /**
21
     * @var Endpoint
22
     */
23
    private $node = null;
24
25
    /**
26
     * Changed constructor.
27
     * @param int $evs
28
     * @param Endpoint $node
29
     */
30
    public function __construct(int $evs, Endpoint $node)
31
    {
32
        $this->evs = $evs;
33
        $this->node = $node;
34
    }
35
36
    /**
37
     * @return bool
38
     */
39
    public function joined() : bool
40
    {
41
        return $this->evs === Events::JOIN;
42
    }
43
44
    /**
45
     * @return bool
46
     */
47
    public function leaved() : bool
48
    {
49
        return $this->evs === Events::LEAVE;
50
    }
51
52
    /**
53
     * @return Endpoint
54
     */
55
    public function target() : Endpoint
56
    {
57
        return $this->node;
58
    }
59
}
60