QA_Peardoc_Coverage
[ class tree: QA_Peardoc_Coverage ] [ index: QA_Peardoc_Coverage ] [ all elements ]

Source for file StatusOverview.php

Documentation is available at StatusOverview.php

  1. <?php
  2. require_once 'QA/Peardoc/Coverage/Renderer.php';
  3.  
  4. /**
  5. * Puts the coverage result into the PEAR_QA_CI StatusOverview
  6. * database.
  7. *
  8. @category QA
  9. @package  QA_Peardoc_Coverage
  10. @author   Christian Weiske <cweiske@php.net>
  11. @license  http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  12. @version  CVS: $Id: StatusOverview.php,v 1.3 2007/07/18 18:52:44 cweiske Exp $
  13. @link     http://pear.php.net/package/QA_Peardoc_Coverage
  14. */
  15.     implements QA_Peardoc_Coverage_Renderer
  16. {
  17.  
  18.     /**
  19.     * Renders the given coverage array and returns the HTML.
  20.     *
  21.     * @param array $arDoc   Documentation check results array
  22.     * @param array $options Array with a statusoverview object
  23.     *
  24.     * @return boolean true if all was ok
  25.     */
  26.     public function render($arDoc$options = null)
  27.     {
  28.         if (!isset($options[0])
  29.             || !($options[0instanceof QA_PEAR_CI_StatusOverview)
  30.         {
  31.             throw new Exception(
  32.                 'Please pass a StatusOverview object as only option'
  33.             );
  34.         }
  35.  
  36.         $so $options[0];
  37.         $so->registerCategory('doc');
  38.  
  39.         foreach ($arDoc as $strCategory => $arCategoryPackages{
  40.             if ($strCategory[0== '*'{
  41.                 continue;
  42.             }
  43.  
  44.             foreach ($arCategoryPackages as $strPackageName => $arPackageCoverage{
  45.                 //in case there is no error :)
  46.                 $so->addPackage($strPackageName);
  47.  
  48.                 if ($arPackageCoverage['*docid*'=== null{
  49.                     //not documented
  50.                     $so->addError(
  51.                         $strPackageName,
  52.                         'doc',
  53.                         'No documentation at all');
  54.                 else {
  55.                     //documented
  56.                     self::getMethodDocState(
  57.                         $strPackageName,
  58.                         $arPackageCoverage,
  59.                         $so
  60.                     );
  61.                 }
  62.             }//foreach package in category
  63.         }//foreach category
  64.  
  65.         $so->save();
  66.         return true;
  67.     }//public function render($arDoc)
  68.  
  69.  
  70.  
  71.     /**
  72.     * Generates the class/method coverage html
  73.     *
  74.     * @param string                    $strPackageName    Package name
  75.     * @param array                     $arPackageCoverage Coverage array for
  76.     *                                                       that package
  77.     * @param QA_PEAR_CI_StatusOverview $so                StatusOverview object
  78.     * @return void 
  79.     */
  80.     public static function getMethodDocState($strPackageName$arPackageCoverage$so)
  81.     {
  82.         foreach ($arPackageCoverage as $strClass => $arMethods{
  83.             if ($strClass[0== '*'{
  84.                 continue;
  85.             }
  86.  
  87.             if ($arMethods === null{
  88.                 //FIXME: display not docced
  89.                 $so->addWarning(
  90.                     $strPackageName,
  91.                     'doc',
  92.                     $strClass ' undocumented'
  93.                 );
  94.                 continue;
  95.             }
  96.  
  97.             foreach ($arMethods as $strMethod => $bDocumented{
  98.                 if ($strMethod[0== '_'{
  99.                     continue;
  100.                 }
  101.  
  102.                 if (!$bDocumented{
  103.                     $so->addWarning(
  104.                         $strPackageName,
  105.                         'doc',
  106.                         $strClass '::' $strMethod ' undocumented'
  107.                     );
  108.                 }
  109.             }
  110.         }
  111.     }//public static function getMethodDocState($arPackageCoverage)
  112.  
  113. }//class QA_Peardoc_Coverage_Renderer_StatusOverview
  114. ?>

Documentation generated on Mon, 11 Mar 2019 15:07:37 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.