Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| Sample | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getLabelValues | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getValue | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * @license GPL-2.0-or-later |
| 4 | * @file |
| 5 | */ |
| 6 | |
| 7 | declare( strict_types=1 ); |
| 8 | |
| 9 | namespace Wikimedia\Stats; |
| 10 | |
| 11 | /** |
| 12 | * A container for a metric sample to be passed to the rendering function. |
| 13 | * |
| 14 | * @author Cole White |
| 15 | * @since 1.41 |
| 16 | */ |
| 17 | class Sample { |
| 18 | |
| 19 | /** @var string[] */ |
| 20 | private array $labelValues; |
| 21 | private float $value; |
| 22 | |
| 23 | /** |
| 24 | * @param string[] $labelValues |
| 25 | * @param float $value |
| 26 | */ |
| 27 | public function __construct( array $labelValues, float $value ) { |
| 28 | $this->labelValues = $labelValues; |
| 29 | $this->value = $value; |
| 30 | } |
| 31 | |
| 32 | /** @return string[] */ |
| 33 | public function getLabelValues(): array { |
| 34 | return $this->labelValues; |
| 35 | } |
| 36 | |
| 37 | public function getValue(): float { |
| 38 | return $this->value; |
| 39 | } |
| 40 | } |