1 | <?php |
||
18 | final class InfluxDbEventListener |
||
19 | { |
||
20 | const STORAGE_KEY_UDP = 'udp'; |
||
21 | const STORAGE_KEY_HTTP = 'http'; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $connection; |
||
27 | |||
28 | /** |
||
29 | * @var bool |
||
30 | */ |
||
31 | private $isDefault; |
||
32 | |||
33 | /** |
||
34 | * @var Database |
||
35 | */ |
||
36 | private $httpDatabase; |
||
37 | |||
38 | /** |
||
39 | * @var Database |
||
40 | */ |
||
41 | private $udpDatabase; |
||
42 | |||
43 | /** |
||
44 | * @var array |
||
45 | */ |
||
46 | private $storage; |
||
47 | |||
48 | /** |
||
49 | * @param string $connection |
||
50 | * @param bool $isDefault |
||
51 | * @param Database $httpDatabase |
||
52 | * @param Database $udpDatabase |
||
53 | */ |
||
54 | 7 | public function __construct(string $connection, bool $isDefault, Database $httpDatabase, Database $udpDatabase = null) |
|
62 | |||
63 | /** |
||
64 | * @param AbstractInfluxDbEvent $event |
||
65 | * |
||
66 | * @return bool |
||
67 | */ |
||
68 | 7 | public function onPointsCollected(AbstractInfluxDbEvent $event): bool |
|
86 | |||
87 | /** |
||
88 | * @param Event $event |
||
89 | * |
||
90 | * @return bool |
||
91 | */ |
||
92 | 2 | public function onKernelTerminate(Event $event): bool |
|
107 | |||
108 | 7 | private function initStorage() |
|
109 | { |
||
110 | 7 | $this->storage = [ |
|
111 | 7 | static::STORAGE_KEY_UDP => [], |
|
112 | 7 | static::STORAGE_KEY_HTTP => [], |
|
113 | ]; |
||
114 | 7 | } |
|
115 | |||
116 | /** |
||
117 | * @param Point[] $points |
||
118 | * @param string $precision |
||
119 | */ |
||
120 | 2 | private function writeUdpPoints(array $points, string $precision) |
|
124 | |||
125 | /** |
||
126 | * @param Point[] $points |
||
127 | * @param string $precision |
||
128 | */ |
||
129 | 2 | private function writeHttpPoints(array $points, string $precision) |
|
133 | |||
134 | /** |
||
135 | * @param AbstractInfluxDbEvent $event |
||
136 | */ |
||
137 | 2 | private function addEventPointsToStorage(AbstractInfluxDbEvent $event) |
|
151 | |||
152 | /** |
||
153 | * @param AbstractInfluxDbEvent $event |
||
154 | * |
||
155 | * @return bool |
||
156 | */ |
||
157 | 7 | private function isConcerned(AbstractInfluxDbEvent $event): bool |
|
161 | |||
162 | /** |
||
163 | * @param AbstractInfluxDbEvent $event |
||
164 | */ |
||
165 | 6 | private function testUdpConnection(AbstractInfluxDbEvent $event) |
|
174 | |||
175 | /** |
||
176 | * @param AbstractInfluxDbEvent $event |
||
177 | */ |
||
178 | 2 | private function writeEventPoints(AbstractInfluxDbEvent $event) |
|
191 | } |
||
192 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.