Passed
Push — master ( a35b5f...c35142 )
by Vitor de
02:29
created

Base::setOption()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
3
namespace GFG\Mapper\Data\Type;
4
5
use GFG\Mapper\Data\MapperInterface;
6
7
abstract class Base
8
{
9
    protected $mapper;
10
    protected $options;
11
12 9
    public function __construct(MapperInterface $mapper, array $options)
13
    {
14 9
        $this->mapper  = $mapper;
15 9
        $this->options = $options;
16 9
    }
17
18 6
    public function get($key)
19
    {
20 6
        return $this->mapper->get($this->options['prefix'] . '_' . $key);
21
    }
22
23 1
    public function setOptions(array $options)
24
    {
25 1
        $this->options = $options;
26 1
        return $this;
27
    }
28
29 3
    public function setOption($option, $value)
30
    {
31 3
        $this->options[$option] = $value;
32 3
        return $this;
33
    }
34
35 3
    public function getOptions()
36
    {
37 3
        return $this->options;
38
    }
39
40
    abstract public function run(&$data, $key = null);
41
}
42