Completed
Pull Request — master (#14)
by Бабичев
02:43
created

WalletProxy::fresh()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Bavix\Wallet;
4
5
class WalletProxy
6
{
7
8
    /**
9
     * @var array
10
     */
11
    protected static $rows = [];
12
13
    /**
14
     * @param int $key
15
     * @return bool
16
     */
17
    public static function has(int $key): bool
18
    {
19
        return \array_key_exists($key, static::$rows);
20
    }
21
22
    /**
23
     * @param int $key
24
     * @return int
25
     */
26
    public static function get(int $key): int
27
    {
28
        return (int) (static::$rows[$key] ?? 0);
29
    }
30
31
    /**
32
     * @param int $key
33
     * @param int $value
34
     */
35
    public static function set(int $key, int $value): void
36
    {
37
        static::$rows[$key] = $value;
38
    }
39
40
    /**
41
     * @return void
42
     */
43
    public static function fresh(): void
44
    {
45
        static::$rows = [];
46
    }
47
48
}
49