I don't want to document interface methods
[m6w6/ext-http] / scripts / check_docs.php
1 #!/usr/bin/env php
2 <?php
3 // $Id$
4
5 function re($file, $re, &$m=NULL) {
6 global $doc;
7 return file_exists("$doc/$file") ? preg_match($re, file_get_contents("$doc/$file"), $m) : 0;
8 }
9 function fe($file) {
10 global $doc;
11 return file_exists("$doc/$file");
12 }
13 function fg($path, &$g=NULL) {
14 global $doc;
15 return count($g = glob("$doc/$path"));
16 }
17
18 $doc = "/home/mike/cvs/phpdoc/en/reference/http";
19 $ext = new ReflectionExtension("http");
20
21 printf("Undocumented INI options:\n");
22 foreach ($ext->getINIEntries() as $name => $tmp) {
23 re("configuration.xml", "#<entry>$name</entry>#") or printf("\t%s (%s)\n", $name, $tmp);
24 }
25 printf("\n");
26
27 printf("Undocumented constants:\n");
28 foreach ($ext->getConstants() as $name => $tmp) {
29 re("constants.xml", "#<constant>$name</constant>#") or printf("\t%s (%s)\n", $name, $tmp);
30 }
31 printf("\n");
32
33
34 printf("Undocumented functions:\n");
35 foreach ($ext->getFunctions() as $func) {
36 /* @var $func ReflectionFunction */
37 fg(sprintf("functions/*/%s.xml", strtr($func->getName(),'_','-'))) or printf("\t%s()\n", $func->getName());
38 }
39 printf("\n");
40
41 printf("Undocumented classes/members:\n");
42 foreach ($ext->getClasses() as $class) {
43 if (substr($class->getName(), -strlen("Exception")) === "Exception") continue;
44 /* @var $class ReflectionClass */
45 fg(sprintf("%s.xml", $class->getName())) or printf(" %s\n", $class->getName());
46 foreach ($class->getConstants() as $name => $tmp) {
47 re($class->getName().".xml", "#>$name<#") or printf("\t%s::%s (%s)\n", $class->getName(), $name, $tmp);
48 }
49 foreach ($class->getProperties() as $prop) {
50 // blatant guess
51 re($class->getName().".xml", "#>{$prop->getName()}<#") or printf("\t%s::$%s\n", $class->getName(), $prop->getName());
52 }
53 foreach ($class->getMethods() as $meth) {
54 /* @var $meth ReflectionMethod */
55 try {
56 $meth->getPrototype();
57 } catch (Exception $ex) {
58 // if getPrototype throws an exception it's definitely not a method declared in an interface
59 fg(sprintf("%s/%s.xml", $class->getName(), strtr(trim($meth->getName(),'_'),'_','-'))) or printf("\t%s::%s()\n", $class->getName(), $meth->getName());
60 }
61
62 }
63 printf("\n");
64 }
65 printf("\n");
66
67 ?>