| Total Complexity | 7 |
| Total Lines | 74 |
| Duplicated Lines | 0 % |
| Coverage | 64.71% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | abstract class Gauge extends Metric implements Incrementable, Decrementable, Settable |
||
| 11 | { |
||
| 12 | use TracksExecutionTime; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * {@inheritdoc} |
||
| 16 | */ |
||
| 17 | 15 | public function type(): string |
|
| 18 | { |
||
| 19 | 15 | return 'gauge'; |
|
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * {@inheritdoc} |
||
| 24 | * |
||
| 25 | * @return self |
||
| 26 | */ |
||
| 27 | public function increment(array $labels = []): Incrementable |
||
| 28 | { |
||
| 29 | return $this->incrementBy(1, $labels); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * {@inheritdoc} |
||
| 34 | * |
||
| 35 | * @return self |
||
| 36 | */ |
||
| 37 | 10 | public function incrementBy(float $value, array $labels = []): Incrementable |
|
| 38 | { |
||
| 39 | 10 | static::$storage->increment($this, $value, $labels); |
|
| 40 | |||
| 41 | 10 | return $this; |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * {@inheritdoc} |
||
| 46 | * |
||
| 47 | * @return self |
||
| 48 | */ |
||
| 49 | public function decrement(array $labels = []): Decrementable |
||
| 50 | { |
||
| 51 | return $this->decrementBy(1, $labels); |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * {@inheritdoc} |
||
| 56 | * |
||
| 57 | * @return self |
||
| 58 | */ |
||
| 59 | 5 | public function decrementBy(float $value, array $labels = []): Decrementable |
|
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * {@inheritdoc} |
||
| 68 | * |
||
| 69 | * @return self |
||
| 70 | */ |
||
| 71 | 5 | public function set(float $value, array $labels = []): Settable |
|
| 72 | { |
||
| 73 | 5 | static::$storage->set($this, $value, $labels); |
|
| 74 | |||
| 75 | 5 | return $this; |
|
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * {@inheritdoc} |
||
| 80 | */ |
||
| 81 | protected function track(float $value, array $labels = []): void |
||
| 84 | } |
||
| 85 | } |
||
| 86 |