SuitePath::getExcludedPaths()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ParaTest\Runners\PHPUnit;
6
7
/**
8
 * Representation of test suite paths found in phpunit.xml.
9
 */
10
class SuitePath
11
{
12
    const DEFAULT_SUFFIX = 'Test.php';
13
14
    /**
15
     * @var string
16
     */
17
    protected $path;
18
19
    /**
20
     * @var string
21
     */
22
    protected $suffix;
23
24
    /**
25
     * @var string[]s
26
     */
27
    protected $excludedPaths;
28
29 14
    public function __construct(string $path, array $excludedPaths, string $suffix)
30
    {
31 14
        if (empty($suffix)) {
32 14
            $suffix = self::DEFAULT_SUFFIX;
33
        }
34 14
        $this->path = $path;
35 14
        $this->excludedPaths = $excludedPaths;
36 14
        $this->suffix = $suffix;
37 14
    }
38
39
    /**
40
     * @return string
41
     */
42 14
    public function getPath(): string
43
    {
44 14
        return $this->path;
45
    }
46
47
    /**
48
     * @return string[]
49
     */
50 12
    public function getExcludedPaths(): array
51
    {
52 12
        return $this->excludedPaths;
53
    }
54
55
    /**
56
     * @return string
57
     */
58 12
    public function getSuffix(): string
59
    {
60 12
        return $this->suffix;
61
    }
62
63
    /**
64
     * @return string
65
     */
66 12
    public function getPattern(): string
67
    {
68 12
        return '|' . preg_quote($this->getSuffix()) . '$|';
69
    }
70
}
71