- created branch R_1_5
[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
19 $ext = "http";
20 $doc = "/home/mike/cvs/phpdoc/en/reference/$ext";
21 $ref = new ReflectionExtension($ext);
22
23 $ini = $ref->getINIEntries();
24 printf("Undocumented INI options (%d):\n", count($ini));
25 foreach ($ini as $name => $tmp) {
26 re("configuration.xml", "#<entry>$name</entry>#") or printf("\t%s (%s)\n", $name, $tmp);
27 }
28 printf("\n");
29
30 $flt = preg_grep("/^$ext\./", stream_get_filters());
31 printf("Undocumented stream filters (%d):\n", count($flt));
32 foreach ($flt as $filter) {
33 fe(sprintf("streamfilters/%s.xml", substr($filter, 5))) or printf("\t%s\n", $filter);
34 }
35 printf("\n");
36
37 $con = $ref->getConstants();
38 printf("Undocumented constants (%d):\n", count($con));
39 foreach ($con as $name => $tmp) {
40 re("constants.xml", "#<constant>$name</constant>#") or printf("\t%s (%s)\n", $name, $tmp);
41 }
42 printf("\n");
43
44
45 printf("Undocumented functions:\n");
46 foreach ($ref->getFunctions() as $func) {
47 /* @var $func ReflectionFunction */
48 fg(sprintf("functions/*/%s.xml", strtr($func->getName(),'_','-'))) or printf("\t%s()\n", $func->getName());
49 }
50 printf("\n");
51
52 printf("Undocumented classes/members:\n");
53 foreach ($ref->getClasses() as $class) {
54 if (substr($class->getName(), -strlen("Exception")) === "Exception") continue;
55 /* @var $class ReflectionClass */
56 fg(sprintf("%s.xml", $class->getName())) or printf(" %s\n", $class->getName());
57 foreach ($class->getConstants() as $name => $tmp) {
58 re($class->getName().".xml", "#>$name<#") or printf("\t%s::%s (%s)\n", $class->getName(), $name, $tmp);
59 }
60 foreach ($class->getProperties() as $prop) {
61 /* @var $prop ReflectionProperty */
62 $prop->isPrivate() or re($class->getName().".xml", "#>{$prop->getName()}<#") or printf("\t%s::$%s\n", $class->getName(), $prop->getName());
63 }
64 foreach ($class->getMethods() as $meth) {
65 /* @var $meth ReflectionMethod */
66 try {
67 $meth->getPrototype();
68 } catch (Exception $ex) {
69 // if getPrototype throws an exception it's definitely not a method declared in an interface
70 $meth->isPrivate() or fg(sprintf("%s/%s.xml", $class->getName(), strtr(trim($meth->getName(),'_'),'_','-'))) or printf("\t%s::%s()\n", $class->getName(), $meth->getName());
71 }
72
73 }
74 printf("\n");
75 }
76 printf("\n");
77
78 ?>