Cell::hasTransformer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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