Passed
Push — master ( dc00b6...0db761 )
by Phillip
02:45
created

LocatorParameter::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace PHPassword\Locator;
4
5
6
class LocatorParameter implements LocatorParameterInterface
7
{
8
    /**
9
     * @var array
10
     */
11
    private $parameter;
12
13
    /**
14
     * LocatorParameter constructor.
15
     * @param array $parameter
16
     */
17 4
    public function __construct(array $parameter = [])
18
    {
19 4
        $this->parameter = $parameter;
20 4
    }
21
22
    /**
23
     * @param string $index
24
     * @param mixed $default
25
     * @return mixed
26
     */
27 1
    public function get(string $index, $default = null)
28
    {
29 1
        return $this->parameter[$index] ?? $default;
30
    }
31
}