| +----------------------------------------------------------------------+ $Id$ */ /** * @todo * Add support for online doc editing * Add count of "perfect" functions * Get this on https://doc.php.net/ */ $errors = array( 'undoc' => array( 'label' => 'Not documented', 'description' => 'These are the undocumented functions: The function which XML skeleton is in CVS, and contain &warn.undocumented.func;' ), 'oldstyle' => array( 'label' => 'Old style', 'description' => 'These functions are not converted to the new doc style yet, and thus, are not checked', ), 'badorder' => array( 'label' => 'Bad refsect1 order', 'description' => 'These functions are converted to the new doc style, but the refsect1 are not well ordered', ), 'noparameters' => array( 'label' => 'No parameters', 'description' => 'These functions lacks parameters description.', ), 'noreturnvalues' => array( 'label' => 'No return values', 'description' => 'These functions lacks return values information', ), 'noexamples' => array( 'label' => 'No examples', 'description' => 'These functions lacks examples.', ), 'nochangelog' => array( 'label' => 'No changelog section', 'description' => 'These functions lacks changelog refsect1 while metionning "PHP \d" in the XML source.', ), 'noerrors' => array( 'label' => 'No errors section', 'description' => 'These functions lacks errors information.', ), 'noseealso' => array( 'label' => 'No see also', 'description' => 'These functions lacks link to other functions/sections. You may consider adding some cross links to point readers to valuable resources.', ), 'roleerror' => array( 'label' => 'Refsect1 role error', 'description' => 'One or more <refsect1> tags use an unknown role attribute value', ), ); $restrict = (isset($_GET['restrict']) && isset($errors[$_GET['restrict']])) ? $_GET['restrict'] : false; echo '' . "\n"; ?> PHPDOC Check<?php if ($restrict && isset($errors[$restrict])) { echo ' > ' . $errors[$restrict]['label']; } ?> PHPDOC Check'; if (!$restrict) { $order = isset($_GET['order']) && $_GET['order'] == 'DESC' ? 'DESC' : 'ASC'; $sort = isset($_GET['sort']) && in_array($_GET['sort'], array_keys($errors)) ? 'SUM(' . $_GET['sort'] . ')' : 'extension'; $sql = 'SELECT extension, COUNT(*) AS total, SUM(' . implode('), SUM(', array_keys($errors)) . ') FROM reference GROUP BY extension ORDER BY ' . $sort . ' ' . $order; $result = sqlite_query($dbhandle, $sql); $extensions = array(); while ($row = sqlite_fetch_array($result, SQLITE_ASSOC)) { $extensions[$row['extension']] = $row; } echo '

This script parses the reference/ directory of the PHPDOC module and checks for common problems in the documentation. For now, supported tests are:

'; echo ''; echo ''; echo ''; $order = ($order == 'ASC') ? 'DESC' : 'ASC'; foreach ($errors as $type => $info) { echo ""; } echo ''; foreach ($extensions as $extension => $stats) { echo ""; echo ""; foreach ($errors as $type => $info) { echo ""; } echo ""; } echo '
Extension{$info['label']}
$extension' . $stats['SUM(' . $type . ')'] . '' : '> '). "
'; } else { $query = sqlite_query($dbhandle, 'SELECT * FROM reference WHERE ' . $restrict . ' = 1'); $status = array(); $result = sqlite_fetch_all($query, SQLITE_ASSOC); foreach ($result as $res) { $status[$res['extension']][$res['funcname']] = $res; } echo '

'; echo "
{$errors[$restrict]['label']} (All)
{$errors[$restrict]['description']}
"; echo '

'; echo '

'; foreach ($status as $extension => $functions) { $nb = count($functions); if ($nb != 0) { $funcn += $nb; $exts .= '' . $extension . ' '; } } echo "$funcn functions from " . count($status) . " extensions: $exts"; echo '

'; echo ''; foreach ($status as $extension => $functions) { $i = 0; echo ''; foreach ($functions as $function => $problems) { if (!isset($problems[$restrict])) { continue; } if ($i % 4 == 0) { echo ''; } $i++; echo ""; if ($i % 4 == 0) { echo ''; } } } echo '
' . $extension . ' (' . count($functions) . ')
$function
'; } ?>