Passed
Branch version-4 (8b03a3)
by Sebastian
02:18
created

Pair   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 64.29%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 53
ccs 9
cts 14
cp 0.6429
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setValue() 0 3 1
A getValue() 0 3 1
A getKey() 0 3 1
A setKey() 0 3 1
A __construct() 0 5 1
1
<?php
2
3
namespace Seboettg\Collection\Map;
4
5
use function Seboettg\Collection\Assert\assertScalar;
6
7
class Pair
8
{
9
    /**
10
     * @var bool|float|int|string
11
     */
12
    private $key;
0 ignored issues
show
Coding Style introduced by
Private member variable "key" must contain a leading underscore
Loading history...
13
14
    /**
15
     * @var mixed
16
     */
17
    private $value;
0 ignored issues
show
Coding Style introduced by
Private member variable "value" must contain a leading underscore
Loading history...
18
19
    /**
20
     * @param scalar $key
21
     * @param mixed $value
22
     */
23 22
    public function __construct($key, $value)
24
    {
25 22
        assertScalar($key, "Key must be a scalar.");
26 22
        $this->key = $key;
27 22
        $this->value = $value;
28 22
    }
29
30
    /**
31
     * @return scalar
32
     */
33 22
    public function getKey()
34
    {
35 22
        return $this->key;
36
    }
37
38
    /**
39
     * @param mixed $key
40
     */
41
    public function setKey($key): void
42
    {
43
        $this->key = $key;
44
    }
45
46
    /**
47
     * @return mixed
48
     */
49 22
    public function getValue()
50
    {
51 22
        return $this->value;
52
    }
53
54
    /**
55
     * @param mixed $value
56
     */
57
    public function setValue($value): void
58
    {
59
        $this->value = $value;
60
    }
61
}
62