Total Complexity | 6 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
10 | class ServerStats |
||
11 | { |
||
12 | private $stats; |
||
13 | |||
14 | /** |
||
15 | * ServerStats constructor. |
||
16 | * |
||
17 | * @param array $stats |
||
18 | */ |
||
19 | 3 | public function __construct(array $stats) |
|
22 | 3 | } |
|
23 | |||
24 | /** |
||
25 | * Returns the timestamp of server since start |
||
26 | * |
||
27 | * @return int |
||
28 | */ |
||
29 | 1 | public function getStartTime(): int |
|
30 | { |
||
31 | 1 | return $this->stats['start_time']; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Returns the number of current connections |
||
36 | * |
||
37 | * @return int |
||
38 | */ |
||
39 | 1 | public function getConnections(): int |
|
40 | { |
||
41 | 1 | return $this->stats['connection_num']; |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * Returns the number of accepted connections |
||
46 | * |
||
47 | * @return int |
||
48 | */ |
||
49 | 1 | public function getAcceptedConnections(): int |
|
50 | { |
||
51 | 1 | return $this->stats['accept_count']; |
|
52 | } |
||
53 | |||
54 | /** |
||
55 | * Returns the number of closed connections |
||
56 | * |
||
57 | * @return int |
||
58 | */ |
||
59 | 1 | public function getClosedConnections(): int |
|
60 | { |
||
61 | 1 | return $this->stats['close_count']; |
|
62 | } |
||
63 | |||
64 | /** |
||
65 | * Returns the number of received requests |
||
66 | * |
||
67 | * @return int |
||
68 | */ |
||
69 | 1 | public function getReceivedRequests(): int |
|
72 | } |
||
73 | } |
||
74 |