Completed
Push — master ( d64c29...1f74a2 )
by Kamil
02:10
created

getLocatorExamples()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the ExcludeSpecificationsExtension package.
7
 *
8
 * (c) Kamil Kokot <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace FriendsOfBehat\ExcludeSpecificationsExtension\Locator;
15
16
use Behat\Testwork\Specification\Locator\SpecificationLocator;
17
use Behat\Testwork\Specification\SpecificationIterator;
18
use Behat\Testwork\Suite\Suite;
19
20
/**
21
 * @internal
22
 */
23
final class ExcludingSpecificationLocator implements SpecificationLocator
24
{
25
    /**
26
     * @var SpecificationLocator
27
     */
28
    private $specificationLocator;
29
30
    /**
31
     * @var array
32
     */
33
    private $skippedPaths;
34
35
    /**
36
     * @param SpecificationLocator $filesystemFeatureLocator
37
     * @param array $skippedPaths
38
     */
39
    public function __construct(SpecificationLocator $filesystemFeatureLocator, array $skippedPaths)
40
    {
41
        $this->specificationLocator = $filesystemFeatureLocator;
42
        $this->skippedPaths = $skippedPaths;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function getLocatorExamples(): array
49
    {
50
        return $this->specificationLocator->getLocatorExamples();
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function locateSpecifications(Suite $suite, $locator): SpecificationIterator
57
    {
58
        return new ExcludingSpecificationIterator(
59
            $this->specificationLocator->locateSpecifications($suite, $locator),
60
            $this->skippedPaths
61
        );
62
    }
63
}
64