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

AbstractSelectionFromMap   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 39
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

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