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

Stats::getAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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