Stats::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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