Total Complexity | 5 |
Total Lines | 72 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | final class Destination implements \JsonSerializable |
||
12 | { |
||
13 | /** |
||
14 | * Destination network address: |
||
15 | * - Hostname (e.g. 'localhost') |
||
16 | * - FQDN (e.g. 'elastic.co') |
||
17 | * - IPv4 (e.g. '127.0.0.1') |
||
18 | * - IPv6 (e.g. '::1') |
||
19 | * |
||
20 | * @var string|null |
||
21 | */ |
||
22 | private $address; |
||
23 | |||
24 | /** |
||
25 | * Destination network port (e.g. 443) |
||
26 | * |
||
27 | * @var int|null |
||
28 | */ |
||
29 | private $port; |
||
30 | |||
31 | /** |
||
32 | * Destination service context |
||
33 | * |
||
34 | * @var Service|null |
||
35 | */ |
||
36 | private $service; |
||
37 | |||
38 | /** |
||
39 | * @param string|null $address |
||
40 | * @param int|null $port |
||
41 | * @param Service|null $service |
||
42 | */ |
||
43 | 2 | public function __construct($address, $port, Service $service = null) |
|
44 | { |
||
45 | 2 | $this->address = $address; |
|
46 | 2 | $this->port = $port; |
|
47 | 2 | $this->service = $service; |
|
48 | 2 | } |
|
49 | |||
50 | /** |
||
51 | * @return string|null |
||
52 | */ |
||
53 | 1 | public function address() |
|
54 | { |
||
55 | 1 | return $this->address; |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * @return int|null |
||
60 | */ |
||
61 | 1 | public function port() |
|
62 | { |
||
63 | 1 | return $this->port; |
|
64 | } |
||
65 | |||
66 | /** |
||
67 | * @return Service|null |
||
68 | */ |
||
69 | 1 | public function service() |
|
70 | { |
||
71 | 1 | return $this->service; |
|
72 | } |
||
73 | |||
74 | /** |
||
75 | * @return array |
||
76 | */ |
||
77 | 1 | public function jsonSerialize() |
|
83 | 1 | ]; |
|
84 | } |
||
85 | } |
||
86 |