1 | <?php |
||
15 | class InfluxDbEventListener |
||
16 | { |
||
17 | |||
18 | /** @var WriterClient */ |
||
19 | private $httpWriter; |
||
20 | |||
21 | /** @var WriterClient */ |
||
22 | private $udpWriter; |
||
23 | |||
24 | /** @var \SplQueue */ |
||
25 | private $pointCollections; |
||
26 | |||
27 | /** |
||
28 | * InfluxDbEventListener constructor. |
||
29 | * @param WriterClient $httpWriter |
||
30 | * @param WriterClient $udpWriter |
||
31 | */ |
||
32 | 4 | public function __construct(WriterClient $httpWriter, WriterClient $udpWriter) |
|
38 | |||
39 | 4 | public function onPointsCollected(InfluxDbEvent $event): bool |
|
55 | |||
56 | /** |
||
57 | * @param Event $event |
||
58 | * @return bool |
||
59 | */ |
||
60 | 2 | public function onKernelTerminate(Event $event): bool |
|
71 | |||
72 | /** |
||
73 | * @param string $writemode |
||
74 | * @param $points |
||
75 | */ |
||
76 | 4 | private function writePoints(string $writemode, $points) |
|
86 | |||
87 | /** |
||
88 | * @param string $getWriteMode |
||
89 | * @param string $getPrecision |
||
90 | */ |
||
91 | 2 | private function initCollection(string $getWriteMode, string $getPrecision) |
|
101 | |||
102 | /** |
||
103 | * @param string $writemode |
||
104 | * @param PointsCollection $points |
||
105 | * @internal param InfluxDbEvent $event |
||
106 | */ |
||
107 | 2 | private function mergeCollections(string $writemode, PointsCollection $points) |
|
119 | |||
120 | } |
||
121 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.