Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
27 / 27 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
1 / 1 |
TaintednessWithError | |
100.00% |
27 / 27 |
|
100.00% |
7 / 7 |
9 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
emptySingleton | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
2 | |||
unknownSingleton | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
2 | |||
getTaintedness | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getError | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getMethodLinks | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
asMergedWith | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 |
1 | <?php declare( strict_types=1 ); |
2 | |
3 | namespace SecurityCheckPlugin; |
4 | |
5 | /** |
6 | * Object that encapsulates a Taintedness and a list of lines that caused it |
7 | */ |
8 | class TaintednessWithError { |
9 | /** @var Taintedness */ |
10 | private $taintedness; |
11 | /** |
12 | * @var CausedByLines |
13 | */ |
14 | private $error; |
15 | |
16 | /** @var MethodLinks */ |
17 | private $methodLinks; |
18 | |
19 | /** |
20 | * @param Taintedness $taintedness |
21 | * @param CausedByLines $error |
22 | * @param MethodLinks $methodLinks |
23 | */ |
24 | public function __construct( Taintedness $taintedness, CausedByLines $error, MethodLinks $methodLinks ) { |
25 | $this->taintedness = $taintedness; |
26 | $this->error = $error; |
27 | $this->methodLinks = $methodLinks; |
28 | } |
29 | |
30 | public static function emptySingleton(): self { |
31 | static $singleton; |
32 | if ( !$singleton ) { |
33 | $singleton = new self( |
34 | Taintedness::safeSingleton(), |
35 | CausedByLines::emptySingleton(), |
36 | MethodLinks::emptySingleton() |
37 | ); |
38 | } |
39 | return $singleton; |
40 | } |
41 | |
42 | public static function unknownSingleton(): self { |
43 | static $singleton; |
44 | if ( !$singleton ) { |
45 | $singleton = new self( |
46 | Taintedness::unknownSingleton(), |
47 | CausedByLines::emptySingleton(), |
48 | MethodLinks::emptySingleton() |
49 | ); |
50 | } |
51 | return $singleton; |
52 | } |
53 | |
54 | /** |
55 | * @return Taintedness |
56 | */ |
57 | public function getTaintedness(): Taintedness { |
58 | return $this->taintedness; |
59 | } |
60 | |
61 | /** |
62 | * @return CausedByLines |
63 | */ |
64 | public function getError(): CausedByLines { |