Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
66 lines (55 sloc) 1.71 KB
<?php
require_once 'base.php';
$filename = $argv[1];
$lines = explode("\n", file_get_contents($filename));
$sig = '// Do NOT modifiy this doc comment block generated by idl/sysdoc.php';
$file = '';
for ($i = 0; $i < count($lines) - 1; $i++) {
$line = $lines[$i];
if (preg_match("#$sig#", $line)) {
while (!preg_match('#^ \*/$#', $line)) {
$line = $lines[++$i];
}
$line = $lines[++$i];
}
if (preg_match('/(?:class|interface) (\w+)/', $line, $m)) {
$class = $m[1];
$info['name'] = $class;
$doc = phpnet_get_class_desc($class);
if (!empty($doc)) {
$info['desc'] = $doc;
$info['flags'] = 0;
$file .= "$sig\n";
$file .= get_class_doc_comments($info)."\n";
}
} else if (preg_match('/function /', $line)) {
while (!preg_match('/function (\w+) *\(([^\)]*)\)/s', $line, $m)) {
$line .= "\n".$lines[++$i];
}
$func = $m[1];
$args = $m[2];
preg_match_all('/(\&?\$\w+)/', $args, $m);
$argdefs = $m[1];
$doc = phpnet_get_function_info($func, $class);
if (!empty($doc)) {
$info['name'] = $func;
$info['desc'] = isset($doc['desc']) ? $doc['desc'] : '';
$info['ret_desc'] = $doc['ret'];
$args = array();
if (!empty($argdefs)) {
$index = 0;
foreach ($argdefs as $name) {
$args[] = array('name' => preg_replace('/[\&\$]/', '', $name),
'desc' => $doc['params'][$index++],
'ref' => preg_match('/&/', $name));
}
}
$info['args'] = $args;
$info['return'] = null;
$file .= "$sig\n";
$file .= get_function_doc_comments($info, $class)."\n";
}
}
$file .= "$line\n";
}
file_put_contents($filename, $file);
Jump to Line
Something went wrong with that request. Please try again.