FinderSearchingContext::getQueryBuilder()   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\Context;
5
6
use Symfony\Component\Finder\Finder;
7
8
/**
9
 * Use this searching context to search for files with Symfony Finder component.
10
 *
11
 * @author Krzysztof Gzocha <[email protected]>
12
 */
13
class FinderSearchingContext extends AbstractSearchingContext
14
{
15
    /**
16
     * @param $finder Finder
17
     */
18 1
    public function __construct(Finder $finder)
19
    {
20 1
        parent::__construct($finder);
21 1
    }
22
23
    /**
24
     * @return Finder
25
     */
26 4
    public function getQueryBuilder(): Finder
27
    {
28 4
        return parent::getQueryBuilder();
29
    }
30
31
    /**
32
     * @return \Iterator
33
     */
34 2
    public function getResults(): \Iterator
35
    {
36 2
        return $this->getQueryBuilder()->getIterator();
37
    }
38
39
    /**
40
     * @return FinderSearchingContext
41
     */
42 1
    public static function buildDefault(): FinderSearchingContext
43
    {
44 1
        return new self(new Finder());
45
    }
46
}
47