WrappedResultsSearcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 26
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A search() 0 7 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