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

LocatorParameter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 24
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A get() 0 3 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
}