Stats   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 51
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A increase() 0 4 1
A set() 0 6 2
A getAll() 0 4 1
A get() 0 4 1
1
<?php
2
3
namespace BrainExe\Core\Stats;
4
5
use BrainExe\Core\Annotations\Service;
6
7
/**
8
 * @Service
9
 */
10
class Stats
11
{
12
13
    /**
14
     * @var Gateway
15
     */
16
    private $gateway;
17
18
    /**
19
     * @param Gateway $gateway
20
     */
21 5
    public function __construct(Gateway $gateway)
22
    {
23 5
        $this->gateway = $gateway;
24 5
    }
25
26
    /**
27
     * @param array $values
28
     */
29 1
    public function increase(array $values)
30
    {
31 1
        $this->gateway->increase($values);
32 1
    }
33
34
    /**
35
     * @param array $values
36
     */
37 2
    public function set(array $values)
38
    {
39 2
        foreach ($values as $key => $value) {
40 2
            $this->gateway->set($key, $value);
41
        }
42 2
    }
43
44
    /**
45
     * @return int[]
46
     */
47 1
    public function getAll() : array
48
    {
49 1
        return $this->gateway->getAll();
50
    }
51
52
    /**
53
     * @param string $key
54
     * @return int
55
     */
56 1
    public function get(string $key) : int
57
    {
58 1
        return $this->gateway->get($key);
59
    }
60
}
61