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

ExcludingSpecificationLocator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getLocatorExamples() 0 4 1
A locateSpecifications() 0 7 1
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