WrappedResultsSearcher::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace KGzocha\Searcher;
5
6
use KGzocha\Searcher\Criteria\Collection\CriteriaCollectionInterface;
7
use KGzocha\Searcher\Result\ResultCollection;
8
9
/**
10
 * Will pass all results from search to ResultCollection.
11
 * Not recommended to use in development environment due to eventual problems with debugging.
12
 * Should be used only if results are supposed to return array or traversable object.
13
 *
14
 * @author Krzysztof Gzocha <[email protected]>
15
 */
16
class WrappedResultsSearcher implements SearcherInterface
17
{
18
    /**
19
     * @var SearcherInterface
20
     */
21
    private $searcher;
22
23
    /**
24
     * @param SearcherInterface $searcher
25
     */
26 1
    public function __construct(SearcherInterface $searcher)
27
    {
28 1
        $this->searcher = $searcher;
29 1
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 1
    public function search(
35
        CriteriaCollectionInterface $criteriaCollection
36
    ): ResultCollection {
37 1
        return new ResultCollection(
38 1
            $this->searcher->search($criteriaCollection)
39
        );
40
    }
41
}
42