3 * This file is part of the PHP_CodeCoverage package.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
14 * @since Class available since Release 1.0.0
16 class PHP_CodeCoverage_Util
21 * @return float ($a / $b) * 100
23 public static function percent($a, $b, $asString = false, $fixedWidth = false)
25 if ($asString && $b == 0) {
30 $percent = ($a / $b) * 100;
37 return sprintf('%6.2F%%', $percent);
40 return sprintf('%01.2F%%', $percent);