1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PHPRealCoverage\Parser\Model; |
4
|
|
|
|
5
|
|
|
use PHPRealCoverage\Mutator\MutatableLine; |
6
|
|
|
use PHPRealCoverage\Proxy\Line; |
7
|
|
|
|
8
|
|
|
class DynamicClassnameCoveredLine implements Line, MutatableLine |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @var Line |
12
|
|
|
*/ |
13
|
|
|
private $line; |
14
|
|
|
/** |
15
|
|
|
* @var string |
16
|
|
|
*/ |
17
|
|
|
private $className; |
18
|
|
|
|
19
|
|
|
public function __construct(Line $line) |
20
|
|
|
{ |
21
|
|
|
$this->line = $line; |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
public function getFilteredContent() |
25
|
|
|
{ |
26
|
|
|
return $this->line->getFilteredContent(); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function isFinal() |
30
|
|
|
{ |
31
|
|
|
return $this->line->isFinal(); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @return bool |
36
|
|
|
*/ |
37
|
|
|
public function isMethod() |
38
|
|
|
{ |
39
|
|
|
return $this->line->isMethod(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function isClass() |
43
|
|
|
{ |
44
|
|
|
return $this->line->isClass(); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function getMethodName() |
48
|
|
|
{ |
49
|
|
|
return $this->line->getMethodName(); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return string |
54
|
|
|
*/ |
55
|
|
|
public function getContent() |
56
|
|
|
{ |
57
|
|
|
return $this->line->getContent(); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function __toString() |
61
|
|
|
{ |
62
|
|
|
return $this->replaceClassname($this->line->__toString()); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function setNeccessary($neccessary) |
66
|
|
|
{ |
67
|
|
|
$this->line->setNeccessary($neccessary); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param string $className |
72
|
|
|
*/ |
73
|
|
|
public function setClassName($className) |
74
|
|
|
{ |
75
|
|
|
$this->className = $className; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getClassName() |
79
|
|
|
{ |
80
|
|
|
return $this->className; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
private function replaceClassname($lineContent) |
84
|
|
|
{ |
85
|
|
|
return str_replace($this->line->getClassName(), $this->className, $lineContent); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function isNeccessary() |
89
|
|
|
{ |
90
|
|
|
return $this->line->isNeccessary(); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @return bool |
95
|
|
|
*/ |
96
|
|
|
public function isCovered() |
97
|
|
|
{ |
98
|
|
|
return $this->line->isCovered(); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @param string $test |
103
|
|
|
*/ |
104
|
|
|
public function addCoverage($test) |
105
|
|
|
{ |
106
|
|
|
$this->line->addCoverage($test); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return bool |
111
|
|
|
*/ |
112
|
|
|
public function isExecutable() |
113
|
|
|
{ |
114
|
|
|
return $this->line->isExecutable(); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function setExecutable($executable) |
118
|
|
|
{ |
119
|
|
|
$this->line->setExecutable($executable); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
public function getCoverage() |
123
|
|
|
{ |
124
|
|
|
return $this->line->getCoverage(); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
public function enable() |
128
|
|
|
{ |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
public function disable() |
132
|
|
|
{ |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @return bool |
137
|
|
|
*/ |
138
|
|
|
public function isEnabled() |
139
|
|
|
{ |
140
|
|
|
return true; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
public function isConstructor() |
144
|
|
|
{ |
145
|
|
|
return $this->line->isConstructor(); |
146
|
|
|
} |
147
|
|
|
} |
148
|
|
|
|