Completed
Push — master ( 66ec7e...c9ec0a )
by Matze
07:32
created

Stats   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

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\Annotations\Annotations\Inject;
6
use BrainExe\Annotations\Annotations\Service;
7
8
/**
9
 * @Service("Stats.Stats", public=false)
10
 */
11
class Stats
12
{
13
14
    /**
15
     * @var Gateway
16
     */
17
    private $gateway;
18
19
    /**
20
     * @Inject("@Stats.Gateway")
21
     * @param Gateway $gateway
22
     */
23
    public function __construct(Gateway $gateway)
24
    {
25
        $this->gateway = $gateway;
26
    }
27
28
    /**
29
     * @param array $values
30
     */
31
    public function increase(array $values)
32
    {
33
        $this->gateway->increase($values);
34
    }
35
36
    /**
37
     * @param array $values
38
     */
39
    public function set(array $values)
40
    {
41
        foreach ($values as $key => $value) {
42
            $this->gateway->set($key, $value);
43
        }
44
    }
45
46
    /**
47
     * @return int[]
48
     */
49
    public function getAll() : array
50
    {
51
        return $this->gateway->getAll();
52
    }
53
54
    /**
55
     * @param string $key
56
     * @return int
57
     */
58
    public function get(string $key) : int
59
    {
60
        return $this->gateway->get($key);
61
    }
62
}
63