Event::getKey()   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 0
crap 1
1
<?php
2
3
namespace BrainExe\Core\Stats;
4
5
use BrainExe\Core\EventDispatcher\AbstractEvent;
6
7
/**
8
 * @api
9
 */
10
class Event extends AbstractEvent
11
{
12
13
    const INCREASE = 'stats.increase';
14
    const SET      = 'stats.set';
15
16
    /**
17
     * @var string
18
     */
19
    private $key;
20
21
    /**
22
     * @var int
23
     */
24
    private $value;
25
26
    /**
27
     * @param string $eventName self::*
28
     * @param string $key
29
     * @param int $value
30
     */
31 2
    public function __construct(string $eventName, string $key, int $value = 1)
32
    {
33 2
        parent::__construct($eventName);
34
35 2
        $this->key   = $key;
36 2
        $this->value = $value;
37 2
    }
38
39
    /**
40
     * @return int
41
     */
42 2
    public function getValue() : int
43
    {
44 2
        return $this->value;
45
    }
46
47
    /**
48
     * @return string
49
     */
50 2
    public function getKey() : string
51
    {
52 2
        return $this->key;
53
    }
54
}
55