Source for file ExtendetPackageList.php
Documentation is available at ExtendetPackageList.php
require_once 'QA/Peardoc/Coverage/Renderer.php';
* Renders the coverage result in an extendet
* list of packages with its documented state,
* and the classes with their methods.
* @package QA_Peardoc_Coverage
* @author Christian Weiske <cweiske@php.net>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version CVS: $Id: ExtendetPackageList.php,v 1.7 2007/07/18 18:52:44 cweiske Exp $
* @link http://pear.php.net/package/QA_Peardoc_Coverage
implements QA_Peardoc_Coverage_Renderer
public static $colNotDocumented = '#F00';
public static $colDocumented = '#0F0';
public static $colMethodDocumented = '#9F9';
public static $colMethodNotDocumented = '#F99';
public static $colMethodPartlyDocumented= '#FF9';
* Returns the color code matching the number.
* @param float $flNumber Number (x/y), !no! percentage
* @return string HTML color #0AF
public static function getColor($flNumber)
} else if ($flNumber >= 0.9 ) {
} else if ($flNumber >= 0.5 ) {
} else if ($flNumber >= 0.3 ) {
}//public static function getColor($flNumber)
* Returns the manual url (deep link) for
* the given documentation id.
* @param string $strDocId Documentation id=""
* @return string URL to the manual
return 'http://pear.php.net/manual/en/'
}//public static function getDocUrl($strDocId)
* Renders the given coverage array and
* @param array $arDoc Documentation coverage analysis results
* @param array $arOptions Options
public function render($arDoc, $arOptions = null )
$out .= '<?xml version="1.0" encoding="utf-8" ?>' . $n
. '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" '
. '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$out .= '<html><head><title>Extendet PEAR Documentation coverage analysis</title>'
. '<style type="text/css">th { background-color: black; color: white; }'
. 'td.class { font-weight:bold;}'
. '</style></head><body>';
$out .= '<table border="1"><caption>'
. 'Extendet PEAR Documentation coverage analysis as of '
. date('Y-m-d H:i:s', $arDoc['*date*'])
//Package name|Class name|methods|number/percent
foreach ($arDoc as $strCategory => $arCategoryPackages) {
if ($strCategory[0 ] == '*') {
$out .= '<tr><th colspan="3">' . ucfirst($strCategory) . '</th></tr>' . $n;
$nCategoryDoccedPackages = 0;
foreach ($arCategoryPackages as $strPackageName => $arPackageCoverage) {
$out .= '<tr><td colspan="2">'
. '<a href="http://pear.php.net/package/' . $strPackageName . '" name="' . $strPackageName . '">'
if ($arPackageCoverage['*docid*'] === null ) {
$out .= '<td style="background-color:'
. self ::$colNotDocumented
. '">undocumented</td></tr>' . $n;
++ $nCategoryDoccedPackages;
$out .= '<td style="background-color:'
. self ::getDocUrl ($arPackageCoverage['*docid*'])
. '">documented</a></td></tr>' . $n;
$out .= self ::getMethodDocState ($arPackageCoverage);
}//foreach package in category
$col = self::getColor($nCategoryDoccedPackages/$nCategoryPackages);
. '<td>' . $nCategoryPackages . '</td>'
. '<td style="text-align:right; font-weight:bold; background-color:' . $col . '">'
. $nCategoryDoccedPackages . '/' . $nCategoryPackages . '</td>'
$col = self ::getColor ($nDoccedPackages/ $nPackages);
$out .= '<tr style="font-weight:bold; background-color:' . $col . '">'
. '<td rowspan="2">' . $nCategories . ' categories</td>'
. '<td style="text-align:right;">Packages documented: ' . $nDoccedPackages . '/' . $nPackages . '</td>'
$out .= '<tr style="font-weight:bold; background-color:' . $col . '">'
. '<td style="text-align:right;">' . number_format($nDoccedPackages/ $nPackages * 100 , 2 ) . '%</td>'
$out .= '</body></html>';
}//public function render($arDoc)
* Generates the class/method coverage html
* @return string Class and method coverage HTML
foreach ($arPackageCoverage as $strClass => $arMethods) {
if ($strClass[0 ] == '*') {
if ($arMethods === null ) {
//FIXME: display not docced
$out .= '<tr><td></td><td class="class">'
. '</td><td style="background-color:' . self ::$colMethodNotDocumented. '">undocumented</td></tr>' . $n;
foreach ($arMethods as $strMethod => $bDocumented) {
if ($strMethod[0 ] == '_') {
$strDocced .= $strMethod . ', ';
$strNotDocced .= $strMethod . ', ';
if ($nMethods > 0 && $nMethods != $nMethodsDocced) {
if ($nMethodsDocced > 0 ) {
. '<td style="background-color:' . self ::$colMethodDocumented . '">'
. '<td>' . $nMethodsDocced . '</td></tr>' . $n;
. '<td style="background-color:' . self ::$colMethodNotDocumented . '">'
. $strNotDocced . '</td>'
. '<td>' . ($nMethods - $nMethodsDocced) . '</td></tr>' . $n;
if ($nMethods == $nMethodsDocced) {
$strState = 'perfect (' . $nMethodsDocced . ')';
$col = self ::$colMethodDocumented;
} else if ($nMethodsDocced == 0 ) {
$strState = 'poor (' . $nMethods . ')';
$col = self ::$colMethodNotDocumented;
$col = self ::$colMethodPartlyDocumented;
. '<td class="class">' . $strClass . '</td>'
. '<td style="background-color:' . $col . '">' . $strState . '</td></tr>' . $n;
}//public static function getMethodDocState($arPackageCoverage)
}//class QA_Peardoc_Coverage_Renderer_ExtendetPackageList
Documentation generated on Mon, 11 Mar 2019 15:10:40 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|