Completed
Push — master-4.0 ( 71618b...2eaeb5 )
by Krzysztof
03:06 queued 03:01
created

Cell::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace KGzocha\Searcher\Chain;
4
5
use KGzocha\Searcher\SearcherInterface;
6
7
/**
8
 * It represents single cell in the chain. It holds sub-searcher and it's transformer, which will
9
 * transform results from it's sub-searcher to CriteriaCollection that can be used in next sub-search.
10
 * Name of the cell will be used as the key of end result collection to allow finding all the results.
11
 * 
12
 * @author Krzysztof Gzocha <[email protected]>
13
 */
14
class Cell implements CellInterface
15
{
16
    /**
17
     * @var SearcherInterface
18
     */
19
    private $searcher;
20
21
    /**
22
     * @var TransformerInterface
23
     */
24
    private $transformer;
25
26
    /**
27
     * @param SearcherInterface    $searcher
28
     * @param TransformerInterface $transformer
29
     */
30 11
    public function __construct(
31
        SearcherInterface $searcher,
32
        TransformerInterface $transformer
33
    ) {
34 11
        $this->searcher = $searcher;
35 11
        $this->transformer = $transformer;
36 11
    }
37
38
    /**
39
     * @return \KGzocha\Searcher\SearcherInterface
40
     */
41 7
    public function getSearcher()
42
    {
43 7
        return $this->searcher;
44
    }
45
46
    /**
47
     * @return TransformerInterface
48
     */
49 7
    public function getTransformer()
50
    {
51 7
        return $this->transformer;
52
    }
53
54
    /**
55
     * @return bool
56
     */
57 8
    public function hasTransformer()
58
    {
59 8
        return !$this->transformer instanceof EndTransformer;
60
    }
61
}
62