ListValue   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 10
c 1
b 0
f 0
dl 0
loc 56
ccs 12
cts 12
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A hasFilterField() 0 3 1
A getSortValue() 0 5 1
A getFilterValue() 0 3 1
A hasListField() 0 3 1
1
<?php
2
3
namespace Povs\ListerBundle\Service;
4
5
use Povs\ListerBundle\Declaration\ListValueInterface;
6
use Povs\ListerBundle\Mapper\FilterMapper;
7
use Povs\ListerBundle\Mapper\ListField;
8
use Povs\ListerBundle\Mapper\ListMapper;
9
10
/**
11
 * @author Povilas Margaiatis <[email protected]>
12
 */
13
class ListValue implements ListValueInterface
14
{
15
    /**
16
     * @var ListMapper
17
     */
18
    private $listMapper;
19
20
    /**
21
     * @var FilterMapper
22
     */
23
    private $filterMapper;
24
25
    /**
26
     * MapperFacade constructor.
27
     *
28
     * @param ListMapper   $listMapper
29
     * @param FilterMapper $filterMapper
30
     */
31 5
    public function __construct(ListMapper $listMapper, FilterMapper $filterMapper)
32
    {
33 5
        $this->listMapper = $listMapper;
34 5
        $this->filterMapper = $filterMapper;
35
    }
36
37
    /**
38
     * @inheritDoc
39
     */
40 1
    public function hasFilterField(string $id): bool
41
    {
42 1
        return $this->filterMapper->has($id);
43
    }
44
45
    /**
46
     * @inheritDoc
47
     */
48 1
    public function hasListField(string $id): bool
49
    {
50 1
        return $this->listMapper->has($id);
51
    }
52
53
    /**
54
     * @inheritDoc
55
     */
56 1
    public function getFilterValue(string $id)
57
    {
58 1
        return $this->filterMapper->getValue($id);
59
    }
60
61
    /**
62
     * @inheritDoc
63
     */
64 1
    public function getSortValue(string $id): ?string
65
    {
66 1
        $field = $this->listMapper->get($id);
67
68 1
        return $field->getOption(ListField::OPTION_SORT_VALUE);
69
    }
70
}
71