3 if (count($_SERVER["argv"]) < 2)
4 die("usage: createdoxygen.php file\n");
6 $file = $_SERVER["argv"][1];
7 $data = file_get_contents($file);
9 $lines = explode("\n", $data);
13 foreach ($lines AS $line) {
14 $line = rtrim(trim($line, "\r"));
16 if (strstr(strtolower($line), "function")) {
17 $detect = strtolower(trim($line));
18 $detect = implode(" ", explode(" ", $detect));
22 if (substr($detect, 0, 9) == "function ")
25 if (substr($detect, 0, 17) == "private function ")
28 if (substr($detect, 0, 23) == "public static function ")
31 if (substr($detect, 0, 10) == "function (")
34 if ($found and (trim($previous) == "*/"))
37 if ($found and !strstr($detect, "{"))
41 echo add_documentation($line);
48 function add_documentation($line) {
50 $trimmed = ltrim($line);
51 $length = strlen($line) - strlen($trimmed);
52 $space = substr($line, 0, $length);
54 $block = $space."/**\n".
55 $space." * @brief \n".
59 $left = strpos($line, "(");
60 $line = substr($line, $left + 1);
62 $right = strpos($line, ")");
63 $line = trim(substr($line, 0, $right));
66 $parameters = explode(",", $line);
67 foreach ($parameters AS $parameter) {
68 $parameter = trim($parameter);
69 $splitted = explode("=", $parameter);
71 $block .= $space." * @param ".trim($splitted[0], "& ")."\n";
73 if (count($parameters) > 0)
74 $block .= $space." *\n";
77 $block .= $space." * @return \n".