echo 'Information: $ phd --docbook /foo/.manual.xml --package IDE --format funclist' . PHP_EOL; exit; } require PHD_INSTALL_DIR . DS . 'phpdotnet' . DS . 'phd' . DS . 'Autoloader.php'; require PHD_INSTALL_DIR . DS . 'phpdotnet' . DS . 'phd' . DS . 'functions.php'; spl_autoload_register(array('phpdotnet\\phd\\Autoloader', 'autoload')); // @todo this may not be needed in the future PhD\Config::init(array()); $api = new PhD\Package_IDE_API(PHD_OUTPUT_DIR); // Gets all documented functions/methods $functions = $api->getFunctionList(); $json_arr = array(); foreach ($functions as $function_name) { // @todo fix source so trim() isn't needed $function_name = trim($function_name); $function = $api->getFunctionByName($function_name); $prototype = (string) $function; // @todo fix this. Replaces class.method with class::method // @todo fix this? Replaces NULL with null, to remain consistent $function_name_fixed = str_replace('.', '::', (string) $function_name); $prototype = str_replace($function_name, $function_name_fixed, $prototype); $prototype = str_replace('NULL', 'null', $prototype); // Some contain new lines, let's remove them $purpose = str_replace("\n", '', (string) $function->getPurpose()); // @todo fix bug when return description contains tables (example: variant_and()) $return = str_replace("\n", '', (string) $function->getReturnDescription()); // Some 'function names' contain spaces, like 'Constants for PDO_4D' // @todo fix this bug in the source if (false !== strpos($function_name_fixed, ' ')) { continue; }
} if ($OPTION['function'] == NULL && $OPTION['class'] == NULL) { trigger_error('You must pass either --class or --function options.', E_USER_ERROR); } $api = new PhD\Package_IDE_API($OPTION['dir']); if ($OPTION['class'] != NULL) { $methods = $api->getMethodsByClass($OPTION['class']); if ($methods == NULL) { trigger_error('Invalid Class name: ' . $OPTION['class'], E_USER_ERROR); } foreach ($methods as $method) { echo $method . PHP_EOL; } exit(0); } $function = $api->getFunctionByName($OPTION['function']); if ($function == NULL) { trigger_error('Invalid Function: ' . $OPTION['function'], E_USER_ERROR); } if ($OPTION['signature'] === true) { echo $function . PHP_EOL; exit(0); } echo 'Name: ' . $function->getName() . PHP_EOL; echo 'Id: ' . $function->getManualID() . PHP_EOL; echo 'Version: ' . $function->getVersion() . PHP_EOL; echo 'Purpose: ' . $function->getPurpose() . PHP_EOL; echo 'Return Type: ' . $function->getReturnType() . PHP_EOL; echo 'Return Description: ' . $function->getReturnDescription() . PHP_EOL; if ($OPTION['all'] === true || $OPTION['params'] === true) { echo 'Params: ';