Skip to content

Commit d58fd20

Browse files
Refactor.
1 parent ee3cd6a commit d58fd20

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

PHP/CodeCoverage/Report/Node.php

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,42 +123,60 @@ public function getParent()
123123
/**
124124
* Returns the percentage of classes that has been tested.
125125
*
126+
* @param boolean $asString
126127
* @return integer
127128
*/
128-
public function getTestedClassesPercent()
129+
public function getTestedClassesPercent($asString = TRUE)
129130
{
130131
return PHP_CodeCoverage_Util::percent(
131132
$this->getNumTestedClasses(),
132133
$this->getNumClasses(),
133-
TRUE
134+
$asString
135+
);
136+
}
137+
138+
/**
139+
* Returns the percentage of traits that has been tested.
140+
*
141+
* @param boolean $asString
142+
* @return integer
143+
*/
144+
public function getTestedTraitsPercent($asString = TRUE)
145+
{
146+
return PHP_CodeCoverage_Util::percent(
147+
$this->getNumTestedTraits(),
148+
$this->getNumTraits(),
149+
$asString
134150
);
135151
}
136152

137153
/**
138154
* Returns the percentage of methods that has been tested.
139155
*
156+
* @param boolean $asString
140157
* @return integer
141158
*/
142-
public function getTestedMethodsPercent()
159+
public function getTestedMethodsPercent($asString = TRUE)
143160
{
144161
return PHP_CodeCoverage_Util::percent(
145162
$this->getNumTestedMethods(),
146163
$this->getNumMethods(),
147-
TRUE
164+
$asString
148165
);
149166
}
150167

151168
/**
152169
* Returns the percentage of executed lines.
153170
*
171+
* @param boolean $asString
154172
* @return integer
155173
*/
156-
public function getLineExecutedPercent()
174+
public function getLineExecutedPercent($asString = TRUE)
157175
{
158176
return PHP_CodeCoverage_Util::percent(
159177
$this->getNumExecutedLines(),
160178
$this->getNumExecutableLines(),
161-
TRUE
179+
$asString
162180
);
163181
}
164182

0 commit comments

Comments
 (0)