FinderSearchingContext   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 34
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

4 Methods

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