| 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 |
|