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 / Sample.php

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

81 lines 1.2 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 Sample
8 {
9 /**
10 * @var string
11 */
12 private $name;
13
14 /**
15 * @var string[]
16 */
17 private $labelNames;
18
19 /**
20 * @var mixed[]
21 */
22 private $labelValues;
23
24 /**
25 * @var int|double
26 */
27 private $value;
28
29 /**
30 * Sample constructor.
31 * @param mixed[] $data
32 */
33 public function __construct(array $data)
34 {
35 $this->name = $data['name'];
36 $this->labelNames = (array) $data['labelNames'];
37 $this->labelValues = (array) $data['labelValues'];
38 $this->value = $data['value'];
39 }
40
41 /**
42 * @return string
43 */
44 public function getName(): string
45 {
46 return $this->name;
47 }
48
49 /**
50 * @return string[]
51 */
52 public function getLabelNames(): array
53 {
54 return $this->labelNames;
55 }
56
57 /**
58 * @return mixed[]
59 */
60 public function getLabelValues(): array
61 {
62 return $this->labelValues;
63 }
64
65 /**
66 * @return string
67 */
68 public function getValue(): string
69 {
70 return (string) $this->value;
71 }
72
73 /**
74 * @return bool
75 */
76 public function hasLabelNames(): bool
77 {
78 return $this->labelNames !== [];
79 }
80 }
81