Gauge   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 34
rs 10
wmc 5
lcom 0
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A inc() 0 4 1
A dec() 0 4 1
A set() 0 4 1
A set_to_current_time() 0 5 1
1
<?php
2
3
namespace Aptarus\PromClient;
4
5
class Gauge extends Metric
6
{
7
    public function __construct(
8
        $var,
9
        $help = "",
10
        $labels = null,
11
        $label_values = null
12
    ) {
13
    
14
        parent::__construct('gauge', $var, $help, $labels, $label_values);
15
    }
16
17
    public function inc($value = 1)
18
    {
19
        $this->metricInc($value);
20
    }
21
22
    public function dec($value = 1)
23
    {
24
        $this->metricInc(-$value);
25
    }
26
27
    public function set($value)
28
    {
29
        $this->metricSet($value);
30
    }
31
32
    // @codingStandardsIgnoreStart
33
    public function set_to_current_time()
34
    {
35
        // @codingStandardsIgnoreEnd
36
        $this->metricSet(time());
37
    }
38
}
39
40
// vim:sw=4 ts=4 et
41