Total Complexity | 6 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
10 | abstract class Summary extends Metric implements Observable |
||
11 | { |
||
12 | /** |
||
13 | * @var int[] |
||
14 | */ |
||
15 | protected $quantiles = [ |
||
16 | .01, |
||
17 | .05, |
||
18 | .5, |
||
19 | .9, |
||
20 | .99, |
||
21 | ]; |
||
22 | |||
23 | /** |
||
24 | * {@inheritdoc} |
||
25 | */ |
||
26 | 9 | public function __construct() |
|
27 | { |
||
28 | 9 | parent::__construct(); |
|
29 | |||
30 | 9 | foreach ($this->labels as $label) { |
|
31 | 9 | if (preg_match('/^quantile$/', $label)) { |
|
32 | 9 | throw new LabelException('The label `quantile` is used internally to designate summary quantiles.'); |
|
33 | } |
||
34 | } |
||
35 | 9 | } |
|
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | 4 | final public function type(): string |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | 4 | public function observe(float $value, array $labels): self |
|
49 | { |
||
50 | 4 | static::$storage->observe($this, $value, $labels); |
|
51 | |||
52 | 4 | return $this; |
|
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return Collection |
||
57 | */ |
||
58 | 6 | public function quantiles(): Collection |
|
61 | } |
||
62 | } |
||
63 |