Source for file SimplePackageList.php
Documentation is available at SimplePackageList.php
require_once 'QA/Peardoc/Coverage/Renderer.php';
* Renders the coverage result in a simple
* list of packages with their documentation state.
* @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: SimplePackageList.php,v 1.6 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';
* 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>Simple PEAR Documentation coverage analysis</title></head><body>';
$out .= '<table border="1"><caption>'
. 'Simple PEAR Documentation coverage analysis as of '
. date('Y-m-d H:i:s', $arDoc['*date*'])
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></td><td>'
. '<a href="http://pear.php.net/package/' . $strPackageName . '" name="' . $strPackageName . '">'
if ($arPackageCoverage['*docid*'] === null ) {
$out .= '<td style="background-color:'
. self ::$colNotDocumented
. '">not documented</td>';
++ $nCategoryDoccedPackages;
$out .= '<td style="background-color:'
. self ::getDocUrl ($arPackageCoverage['*docid*'])
. '">documented</a></td>';
}//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">All in all</td>'
. '<td rowspan="2">' . $nCategories . ' categories</td>'
. '<td style="text-align:right;">' . $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)
}//class QA_Peardoc_Coverage_Renderer_SimplePackageList
Documentation generated on Mon, 11 Mar 2019 15:10:40 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|