PluginProbe
DecaLog / 4.4.0
DecaLog v4.4.0
3.0.2 3.1.0 3.10.0 3.2.0 3.3.0 3.4.0 3.4.1 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.6.3 3.7.0 3.7.1 3.8.0 3.9.0 3.9.1 4.0.0 4.1.0 4.2.0 4.3.0 4.3.1 4.4.0 4.5.0 All 75 releases
decalog / includes / libraries / prometheus / MetricFamilySamples.php

MetricFamilySamples.php in DecaLog 4.4.0, at includes/libraries/prometheus/MetricFamilySamples.php

96 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Prometheus;
6
7 class MetricFamilySamples
8 {
9 /**
10 * @var mixed
11 */
12 private $name;
13
14 /**
15 * @var string
16 */
17 private $type;
18
19 /**
20 * @var string
21 */
22 private $help;
23
24 /**
25 * @var string[]
26 */
27 private $labelNames;
28
29 /**
30 * @var Sample[]
31 */
32 private $samples = [];
33
34 /**
35 * @param mixed[] $data
36 */
37 public function __construct(array $data)
38 {
39 $this->name = $data['name'];
40 $this->type = $data['type'];
41 $this->help = $data['help'];
42 $this->labelNames = $data['labelNames'];
43 foreach ($data['samples'] as $sampleData) {
44 $this->samples[] = new Sample($sampleData);
45 }
46 }
47
48 /**
49 * @return string
50 */
51 public function getName(): string
52 {
53 return $this->name;
54 }
55
56 /**
57 * @return string
58 */
59 public function getType(): string
60 {
61 return $this->type;
62 }
63
64 /**
65 * @return string
66 */
67 public function getHelp(): string
68 {
69 return $this->help;
70 }
71
72 /**
73 * @return Sample[]
74 */
75 public function getSamples(): array
76 {
77 return $this->samples;
78 }
79
80 /**
81 * @return string[]
82 */
83 public function getLabelNames(): array
84 {
85 return $this->labelNames;
86 }
87
88 /**
89 * @return bool
90 */
91 public function hasLabelNames(): bool
92 {
93 return $this->labelNames !== [];
94 }
95 }
96