Passed
Branch master (fb2e38)
by Sebastian
02:23
created

Pair::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
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 50
    public function __construct($key, $value)
24
    {
25 50
        assertScalar($key, "Key must be a scalar.");
26 49
        $this->key = $key;
27 49
        $this->value = $value;
28 49
    }
29
30
    /**
31
     * @return scalar
32
     */
33 49
    public function getKey()
34
    {
35 49
        return $this->key;
36
    }
37
38
    /**
39
     * @return mixed
40
     */
41 49
    public function getValue()
42
    {
43 49
        return $this->value;
44
    }
45
}
46