Passed
Push — master ( a90def...5de986 )
by Chris
04:49
created

AbstractSelectionFromMap::getSelection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace WebTheory\Saveyour\Selections;
4
5
use WebTheory\Saveyour\Contracts\SelectionProviderInterface;
6
7
abstract class AbstractSelectionFromMap implements SelectionProviderInterface
8
{
9
    /**
10
     * @var array
11
     */
12
    protected $selection = [];
13
14
    /**
15
     *
16
     */
17
    public function __construct(array $selection)
18
    {
19
        $this->selection = $selection;
20
    }
21
22
    /**
23
     * Get the value of selection
24
     *
25
     * @return array
26
     */
27
    public function getSelection(): array
28
    {
29
        return $this->selection;
30
    }
31
32
    /**
33
     *
34
     */
35
    public function provideSelectionsData(): array
36
    {
37
        return $this->selection;
38
    }
39
40
    /**
41
     *
42
     */
43
    public function defineSelectionValue($item): string
44
    {
45
        return array_search($item, $this->selection);
46
    }
47
}
48