Completed
Pull Request — master (#204)
by
unknown
02:26
created

SuitePath::getPath()   A

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