Completed
Push — master ( 59d977...e14570 )
by Kristof
07:01 queued 02:22
created

QueryNarrowingSearchService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A search() 0 6 1
1
<?php
2
3
namespace CultuurNet\UDB3\Search\Narrowing;
4
5
use CultuurNet\UDB3\Search\SearchServiceInterface;
6
7
class QueryNarrowingSearchService implements SearchServiceInterface
8
{
9
    /**
10
     * @var SearchServiceInterface
11
     */
12
    private $searchService;
13
14
    /**
15
     * @var QueryNarrowerInterface
16
     */
17
    private $queryNarrower;
18
19
    /**
20
     * QueryNarrowingSearchService constructor.
21
     *
22
     * @param SearchServiceInterface $searchService
23
     * @param QueryNarrowerInterface $queryNarrower
24
     */
25
    public function __construct(SearchServiceInterface $searchService, QueryNarrowerInterface $queryNarrower)
26
    {
27
        $this->searchService = $searchService;
28
        $this->queryNarrower = $queryNarrower;
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function search(string $query, $limit = 30, $start = 0, $sort = null)
35
    {
36
        $narrowedQuery = $this->queryNarrower->narrow($query);
37
38
        return $this->searchService->search($narrowedQuery, $limit, $start, $sort);
39
    }
40
}
41