Total Complexity | 8 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | trait SKeepalive |
||
15 | { |
||
16 | /** |
||
17 | * @var int |
||
18 | */ |
||
19 | private $keepalive = null; |
||
20 | |||
21 | /** |
||
22 | * @var Keepalive |
||
23 | */ |
||
24 | private $daemon = null; |
||
25 | |||
26 | /** |
||
27 | * @param int $heartbeat |
||
28 | * @return self |
||
29 | */ |
||
30 | public function setKeepalive(int $heartbeat) : self |
||
31 | { |
||
32 | $this->keepalive = $heartbeat; |
||
33 | return $this; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @return array |
||
38 | */ |
||
39 | public function getKeepalive() : array |
||
40 | { |
||
41 | return $this->keepalive ? [ |
||
42 | 'TTL' => sprintf('%ds', $this->keepalive + Defaults::KA_TTL_REDUNDANCY), |
||
43 | 'DeregisterCriticalServiceAfter' => sprintf('%dm', Defaults::KA_CRITICAL_TIMEOUT), |
||
44 | ] : []; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | */ |
||
49 | protected function kaStartup() : void |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | */ |
||
57 | protected function kaShutdown() : void |
||
62 | } |
||
63 | } |
||
64 | } |
||
65 |