Metrics   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A summary() 0 3 1
A histogram() 0 3 1
A gauge() 0 3 1
A counter() 0 3 1
1
<?php
2
/**
3
 * Metrics register
4
 * User: moyo
5
 * Date: 2018/5/17
6
 * Time: 9:49 PM
7
 */
8
9
namespace Carno\Monitor;
10
11
use Carno\Monitor\Metrics\Counter;
12
use Carno\Monitor\Metrics\Gauge;
13
use Carno\Monitor\Metrics\Histogram;
14
use Carno\Monitor\Metrics\Summary;
15
16
class Metrics
17
{
18
    /**
19
     * @return Counter
20
     */
21
    public static function counter() : Counter
22
    {
23
        return (new Counter)->register();
24
    }
25
26
    /**
27
     * @param float $initial
28
     * @return Gauge
29
     */
30
    public static function gauge(float $initial = 0) : Gauge
31
    {
32
        return (new Gauge($initial))->register();
33
    }
34
35
    /**
36
     * @return Histogram
37
     */
38
    public static function histogram() : Histogram
39
    {
40
        return (new Histogram)->register();
41
    }
42
43
    /**
44
     * @param float ...$quantiles
45
     * @return Summary
46
     */
47
    public static function summary(float ...$quantiles) : Summary
48
    {
49
        return (new Summary)->quantiles(...$quantiles)->register();
50
    }
51
}
52