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 |
|
101 | |||
102 | /** |
||
103 | * @param Event $event |
||
104 | * |
||
105 | * @return bool |
||
106 | */ |
||
107 | 2 | public function onKernelTerminate(Event $event): bool |
|
122 | |||
123 | 7 | private function initStorage() |
|
124 | { |
||
125 | 7 | $this->storage = [ |
|
126 | 7 | static::STORAGE_KEY_UDP => [], |
|
127 | 7 | static::STORAGE_KEY_HTTP => [], |
|
128 | ]; |
||
129 | 7 | } |
|
130 | |||
131 | /** |
||
132 | * @param Point[] $points |
||
133 | * @param string $precision |
||
134 | */ |
||
135 | 2 | private function writeUdpPoints(array $points, string $precision) |
|
139 | |||
140 | /** |
||
141 | * @param Point[] $points |
||
142 | * @param string $precision |
||
143 | */ |
||
144 | 2 | private function writeHttpPoints(array $points, string $precision) |
|
148 | |||
149 | /** |
||
150 | * @param string $typeKey |
||
151 | * @param string $precision |
||
152 | * @param array $points |
||
153 | */ |
||
154 | 2 | private function addPointsToStorage(string $typeKey, string $precision, array $points) |
|
164 | |||
165 | /** |
||
166 | * @param AbstractInfluxDbEvent $event |
||
167 | * |
||
168 | * @return bool |
||
169 | */ |
||
170 | 7 | private function isConcerned(AbstractInfluxDbEvent $event): bool |
|
174 | } |
||
175 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.