Completed
Branch master (0e0537)
by Krzysztof
02:41
created

ScrollingSearchingContext   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
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 28
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getResults() 0 8 1
1
<?php
2
3
namespace KGzocha\Searcher\Context\Elastica;
4
5
use Elastica\Query;
6
use Elastica\Search;
7
8
/**
9
 * @author Krzysztof Gzocha <[email protected]>
10
 */
11
class ScrollingSearchingContext extends QuerySearchingContext
12
{
13
    /**
14
     * @var string
15
     */
16
    private $expiryTime;
17
18
    /**
19
     * @inheritDoc
20
     */
21 1
    public function __construct(Search $search, Query $query = null, $expiryTime = '1m')
22
    {
23 1
        parent::__construct($search, $query);
24 1
        $this->expiryTime = $expiryTime;
25 1
    }
26
27
    /**
28
     * @return \Elastica\Scroll
29
     */
30 1
    public function getResults()
31
    {
32
        $this
33 1
            ->getSearch()
34 1
            ->setQuery($this->getQueryBuilder());
35
36 1
        return $this->getSearch()->scroll($this->expiryTime);
37
    }
38
}
39