SuitePath   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 61
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A getPath() 0 4 1
A getExcludedPaths() 0 4 1
A getSuffix() 0 4 1
A getPattern() 0 4 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