uw Sun Feb 18 07:29:29 2001 EDT
Modified files:
/php4/pear/PHPDoc/core Phpdoc.php PhpdocArgvHandler.php
PhpdocObject.php PhpdocSetupHandler.php
Log:
Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs
with spaces.
Index: php4/pear/PHPDoc/core/Phpdoc.php
diff -u php4/pear/PHPDoc/core/Phpdoc.php:1.4 php4/pear/PHPDoc/core/Phpdoc.php:1.5
--- php4/pear/PHPDoc/core/Phpdoc.php:1.4 Sun Dec 3 12:30:42 2000
+++ php4/pear/PHPDoc/core/Phpdoc.php Sun Feb 18 07:29:29 2001
@@ -2,237 +2,239 @@
/**
* Coordinates several Phpdoc Object to parse and render source files.
*
-* @access public
-* @version $Id: Phpdoc.php,v 1.4 2000/12/03 20:30:42 uw Exp $
+* @access public
+* @version $Id: Phpdoc.php,v 1.5 2001/02/18 15:29:29 uw Exp $
*/
class Phpdoc extends PhpdocSetupHandler {
- /**
- * Result from the indexer
- *
- * @var array
- * @see render()
- */
- var $indexer_result = array();
+ /**
+ * Result from the indexer
+ *
+ * @var array
+ * @see render()
+ */
+ var $indexer_result = array();
- /**
- * Print status messages
- */
- var $flag_output = true;
+ /**
+ * Print status messages
+ */
+ var $flag_output = true;
- /**
- * Calls the command line handler if necessary.
- *
- * @global array $argc, string $PHP_SELF
- */
- function Phpdoc() {
- global $argc, $PHP_SELF;
+ /**
+ * Calls the command line handler if necessary.
+ *
+ * WARNING: Does not work
+ *
+ * @global array $argc, string $PHP_SELF
+ */
+ function Phpdoc() {
+ global $argc, $PHP_SELF;
- $this->target = $PHP_SELF."apidoc/";
+ $this->target = $PHP_SELF . "apidoc/";
- if ($argc>1)
- $this->handleArgv();
+ if ($argc > 1)
+ $this->handleArgv();
- } // end constructor
+ } // end constructor
- /**
- * Starts the parser.
- *
- * @return bool $ok
- * @throws PhpdocError
- * @access public
- */
- function parse() {
+ /**
+ * Starts the parser.
+ *
+ * @return bool $ok
+ * @throws PhpdocError
+ * @access public
+ */
+ function parse() {
- $this->warn = new PhpdocWarning;
+ $this->warn = new PhpdocWarning;
- $errors = $this->checkStatus();
- if (0 != count($errors)) {
+ $errors = $this->checkStatus();
+ if (0 != count($errors)) {
- reset($errors);
- while (list($k, $error)=each($errors))
- $this->err[] = new PhpdocError($error["msg"]."Errno =
".$error["errno"], 9, __FILE__, __LINE__);
+ reset($errors);
+ while (list($k, $error)=each($errors))
+ $this->err[] = new PhpdocError($error["msg"]."Errno =
+".$error["errno"], 9, __FILE__, __LINE__);
- return false;
- }
+ return false;
+ }
- $this->outl("Parser starts...");
+ $this->outl("Parser starts...");
- // create some objects
- $fileHandler = new PhpdocFileHandler;
- $parser = new PhpdocParser(true);
- $classAnalyser = new PhpdocClassAnalyser;
- $moduleAnalyser = new PhpdocModuleAnalyser;
+ // create some objects
+ $fileHandler = new PhpdocFileHandler;
+ $parser = new PhpdocParser(true);
+ $classAnalyser = new PhpdocClassAnalyser;
+ $moduleAnalyser = new PhpdocModuleAnalyser;
- $indexer = new PhpdocIndexer;
+ $indexer = new PhpdocIndexer;
- $classExporter = new PhpdocXMLClassExporter();
- $classExporter->setPath($this->target);
+ $classExporter = new PhpdocXMLClassExporter();
+ $classExporter->setPath($this->target);
- $moduleExporter = new PhpdocXMLModuleExporter();
- $moduleExporter->setPath($this->target);
+ $moduleExporter = new PhpdocXMLModuleExporter();
+ $moduleExporter->setPath($this->target);
- $indexExporter = new PhpdocXMLIndexExporter();
- $indexExporter->setPath($this->target);
+ $indexExporter = new PhpdocXMLIndexExporter();
+ $indexExporter->setPath($this->target);
- $warningExporter = new PhpdocXMLWarningExporter();
- $warningExporter->setPath($this->target);
+ $warningExporter = new PhpdocXMLWarningExporter();
+ $warningExporter->setPath($this->target);
- // This will change one fine day!
- $parser->warn = $this->warn;
- $classAnalyser->warn = $this->warn;
- $moduleAnalyser->warn = $this->warn;
- $classExporter->warn = $this->warn;
- $moduleExporter->warn = $this->warn;
- $indexer->warn = $this->warn;
+ // This will change one fine day!
+ $parser->warn = $this->warn;
+ $classAnalyser->warn = $this->warn;
+ $moduleAnalyser->warn = $this->warn;
+ $classExporter->warn = $this->warn;
+ $moduleExporter->warn = $this->warn;
+ $indexer->warn = $this->warn;
- $sourcefiles =
$fileHandler->getFilesInDirectory($this->sourceDirectory, $this->sourceFileSuffix);
- $parser->setPhpSourcecodeFiles($fileHandler->get($sourcefiles));
+ $sourcefiles = $fileHandler->getFilesInDirectory($this->sourceDirectory,
+$this->sourceFileSuffix);
+ $parser->setPhpSourcecodeFiles($fileHandler->get($sourcefiles));
- $this->outl("... preparse to find modulegroups and classtrees.");
- $parser->preparse();
+ $this->outl("... preparse to find modulegroups and classtrees.");
+ $parser->preparse();
- $this->outl("... parsing classes.");
- while ($classtree = $parser->getClassTree()) {
+ $this->outl("... parsing classes.");
+ while ($classtree = $parser->getClassTree()) {
- $classAnalyser->setClasses( $classtree,
$parser->current_baseclass );
- $classAnalyser->analyse();
+ $classAnalyser->setClasses( $classtree, $parser->current_baseclass );
+ $classAnalyser->analyse();
- while ($class = $classAnalyser->getClass()) {
- $indexer->addClass($class);
- $classExporter->export($class);
- }
+ while ($class = $classAnalyser->getClass()) {
+ $indexer->addClass($class);
+ $classExporter->export($class);
+ }
- if (floor(phpversion()) > 3) {
+ if (floor(phpversion()) > 3) {
-
$indexExporter->exportClasstree($indexer->getClasstree(), $parser->current_baseclass);
+ $indexExporter->exportClasstree($indexer->getClasstree(),
+$parser->current_baseclass);
- } else {
+ } else {
- $classtree = $indexer->getClasstree();
- $base = $parser->current_baseclass;
- $indexExporter->exportClasstree($classtree, $base);
+ $classtree = $indexer->getClasstree();
+ $base = $parser->current_baseclass;
+ $indexExporter->exportClasstree($classtree, $base);
- }
+ }
- }
+ }
- $this->outl("... parsing modules.");
- while ($modulegroup = $parser->getModulegroup()) {
+ $this->outl("... parsing modules.");
+ while ($modulegroup = $parser->getModulegroup()) {
- $moduleAnalyser->setModulegroup( $modulegroup );
- $moduleAnalyser->analyse();
+ $moduleAnalyser->setModulegroup( $modulegroup );
+ $moduleAnalyser->analyse();
- while ($module = $moduleAnalyser->getModule()) {
- $indexer->addModule($module);
- $moduleExporter->export($module);
- }
+ while ($module = $moduleAnalyser->getModule()) {
+ $indexer->addModule($module);
+ $moduleExporter->export($module);
+ }
- if (floor(phpversion()) > 3) {
+ if (floor(phpversion()) > 3) {
-
$indexExporter->exportModulegroup($indexer->getModulegroup());
+ $indexExporter->exportModulegroup($indexer->getModulegroup());
- } else {
+ } else {
- $modulegroup = $indexer->getModulegroup();
- $indexExporter->exportModulegroup($modulegroup);
+ $modulegroup = $indexer->getModulegroup();
+ $indexExporter->exportModulegroup($modulegroup);
- }
+ }
- }
+ }
- $this->outl("... writing packagelist.");
- if (floor(phpversion()) > 3) {
+ $this->outl("... writing packagelist.");
+ if (floor(phpversion()) > 3) {
- $indexExporter->exportPackagelist($indexer->getPackages());
- $indexExporter->exportElementlist($indexer->getElementlist());
+ $indexExporter->exportPackagelist($indexer->getPackages());
+ $indexExporter->exportElementlist($indexer->getElementlist());
- } else {
+ } else {
- $packages = $indexer->getPackages();
- $indexExporter->exportPackagelist($packages);
- $elements = $indexer->getElementlist();
- $indexExporter->exportElementlist($elements);
+ $packages = $indexer->getPackages();
+ $indexExporter->exportPackagelist($packages);
+ $elements = $indexer->getElementlist();
+ $indexExporter->exportElementlist($elements);
- }
+ }
- $warningExporter->export($parser->warn->getWarnings(), "parser");
- $warningExporter->export($moduleAnalyser->warn->getWarnings(),
"moduleanalyser");
- $warningExporter->export($classAnalyser->warn->getWarnings(),
"classanalyser");
+ $warningExporter->export($parser->warn->getWarnings(), "parser");
+ $warningExporter->export($moduleAnalyser->warn->getWarnings(),
+"moduleanalyser");
+ $warningExporter->export($classAnalyser->warn->getWarnings(),
+"classanalyser");
- $this->outl("Parser finished.");
- return true;
- } // end func parse
+ $this->outl("Parser finished.");
+ return true;
+ } // end func parse
- /**
- * Renders the PHPDoc XML files as HTML files
- *
- * @param string Targetformat, currently only "html" is available.
- * @param string Target directory for the html files
- * @param string Directory with the html templates
- * @return bool $ok
- * @throws PhpdocError
- * @access public
- */
- function render($type = "html", $target = "", $template = "") {
+ /**
+ * Renders the PHPDoc XML files as HTML files
+ *
+ * @param string Targetformat, currently only "html" is available.
+ * @param string Target directory for the html files
+ * @param string Directory with the html templates
+ * @return bool $ok
+ * @throws PhpdocError
+ * @access public
+ */
+ function render($type = "html", $target = "", $template = "") {
- $this->outl("Starting to render...");
- $target = ("" == $target) ? $this->target :
$this->getCheckedDirname($target);
- $template = ("" == $template) ? $this->templateRoot :
$this->getCheckedDirname($template);
+ $this->outl("Starting to render...");
+ $target = ("" == $target) ? $this->target : $this->getCheckedDirname($target);
+ $template = ("" == $template) ? $this->templateRoot :
+$this->getCheckedDirname($template);
- switch(strtolower($type)) {
+ switch (strtolower($type)) {
- case "html":
- default:
- $renderer = new PhpdocHTMLRendererManager($target,
$template, $this->application, $this->targetFileSuffix);
- break;
- }
+ case "html":
+ default:
+ $renderer = new PhpdocHTMLRendererManager($target, $template,
+$this->application, $this->targetFileSuffix);
+ break;
+ }
- $fileHandler = new PhpdocFileHandler;
- $files = $fileHandler->getFilesInDirectory($target, "xml");
- $len = strlen($target);
+ $fileHandler = new PhpdocFileHandler;
+ $files = $fileHandler->getFilesInDirectory($target, "xml");
+ $len = strlen($target);
- $tpl = new IntegratedTemplate($this->templateRoot);
- $tpl->loadTemplateFile("xmlfiles.html");
- $tpl->setCurrentBlock("file_loop");
+ $tpl = new IntegratedTemplate($this->templateRoot);
+ $tpl->loadTemplateFile("xmlfiles.html");
+ $tpl->setCurrentBlock("file_loop");
- // Do not change the file prefixes!
- reset($files);
- while (list($k, $file) = each($files)) {
+ // Do not change the file prefixes!
+ reset($files);
+ while (list($k, $file) = each($files)) {
- $tpl->setVariable("FILE", substr($file, $len));
- $tpl->parseCurrentBlock();
+ $tpl->setVariable("FILE", substr($file, $len));
+ $tpl->parseCurrentBlock();
- if ("class_" == substr($file, $len, 6)) {
+ if ("class_" == substr($file, $len, 6)) {
- $renderer->render(substr($file, $len), "class");
+ $renderer->render(substr($file, $len), "class");
- } else if ("module_" == substr($file, $len, 7)) {
+ } else if ("module_" == substr($file, $len, 7)) {
- $renderer->render(substr($file, $len), "module");
+ $renderer->render(substr($file, $len), "module");
- } else if ("classtree_" == substr($file, $len, 10)) {
+ } else if ("classtree_" == substr($file, $len, 10)) {
- $renderer->render(substr($file, $len), "classtree");
+ $renderer->render(substr($file, $len), "classtree");
- } else if ("modulegroup_" == substr($file, $len, 12)) {
+ } else if ("modulegroup_" == substr($file, $len, 12)) {
- $renderer->render(substr($file, $len), "modulegroup");
+ $renderer->render(substr($file, $len), "modulegroup");
- } else if ("warnings_" == substr($file, $len, 9)) {
+ } else if ("warnings_" == substr($file, $len, 9)) {
- $renderer->render(substr($file, $len), "warning");
+ $renderer->render(substr($file, $len), "warning");
- }
+ }
- }
+ }
- $renderer->finish();
-
$fileHandler->createFile($target."phpdoc_xmlfiles".$this->targetFileSuffix,
$tpl->get());
+ $renderer->finish();
+ $fileHandler->createFile($target."phpdoc_xmlfiles".$this->targetFileSuffix,
+$tpl->get());
- $this->outl($this->finishInstructions);
- return true;
- } // end func render
+ $this->outl($this->finishInstructions);
+ return true;
+ } // end func render
} // end class Phpdoc
?>
Index: php4/pear/PHPDoc/core/PhpdocArgvHandler.php
diff -u php4/pear/PHPDoc/core/PhpdocArgvHandler.php:1.2
php4/pear/PHPDoc/core/PhpdocArgvHandler.php:1.3
--- php4/pear/PHPDoc/core/PhpdocArgvHandler.php:1.2 Sun Dec 3 12:30:42 2000
+++ php4/pear/PHPDoc/core/PhpdocArgvHandler.php Sun Feb 18 07:29:29 2001
@@ -5,157 +5,157 @@
* Be careful the source has not been tested yet, it's probably very buggy.
* Any help and comments are welcome...
*
-* @author Ulf Wendel <[EMAIL PROTECTED]>
-* @version $Id: PhpdocArgvHandler.php,v 1.2 2000/12/03 20:30:42 uw Exp $
+* @author Ulf Wendel <[EMAIL PROTECTED]>
+* @version $Id: PhpdocArgvHandler.php,v 1.3 2001/02/18 15:29:29 uw Exp $
*/
class PhpdocArgvHandler extends PhpdocObject {
-
- /**
- * Message explaining the usage of phpdoc on the command line.
- *
- * Actually it's not the message itself but an array containing
- * the instructions. The array is indexed by the command line option e.g. "-h".
- * The array values hold a short message describing the usage of the option.
- *
- * @var array
- * @access private
- */
- var $COMMANDS = array(
-
"-f filename [, filename]" => "name of files to parse",
-
"-d directory" =>
"name of a directory to parse",
-
"-p path"
=> "path of the files",
-
"-t target"
=> "path where to save the generated files, default is the current path",
-
"-h"
=> "show this help message"
-
);
-
-
- /**
- * Handle the command line values
- *
- * handleArgv() looks for command line values and
- * interprets them. If there're unknown command it prints
- * a message and calls die()
- */
- function handleArgv() {
- global $argv, $argc;
-
- // the first argv is the name of the script,
- // so there must be at least another one
- if ($argc<2) {
- $error = "\n\nCould not understand your request.\n\n";
- $error.= $this->getArgvHelpMessage();
- print $error;
- die();
- }
-
- $commands = 0;
- $errors = array();
-
- reset($argv);
-
- // skip the fist, it's the name of the php script
- next($argv);
-
- while (list($k, $arg)=each($argv)) {
- // valid command?
- if ("-"!=substr($arg, 0, 1))
- continue;
-
- $cmd = substr($arg, 1, 2);
- $value = trim(substr($arg, 3));
-
- // all command line options except -h require values
- if (""==$value && "h"!=$cmd) {
- $errors[] = array(
-
"msg" => sprintf("-%s: no value found", trim($cmd)),
-
"type" => "argv"
-
);
- // skip this command
- continue;
- }
-
- switch ($cmd) {
- case "f ":
- $files = explode(",", substr($arg, 3));
- $this->setFiles($files);
- $commands++;
- break;
-
- case "d ":
- $this->setDirectory($value);
- $commands++;
- break;
-
- case "p ":
- $this->setPath($value);
- $commands++;
- break;
-
- case "t ":
- $this->setTarget($value);
- $commands++;
- break;
-
- case "h ":
- $commands++;
- break;
-
- default:
- $errors[]="unknown command: '$arg'";
- break;
- }
-
- }
-
- // are there enough informations to start work?
- $errors = $this->checkStatus($errors);
-
- // check for errors and die() if neccessary
- if (count($errors)>0) {
- $error = "\n\nCould not understand your request.\n\n";
- reset($errors);
- while (list($k, $data)=each($errors))
- $error.=$data["msg"]."\n";
-
- $error.= $this->getArgvHelpMessage();
- print $error;
- die();
- }
-
- // no errors, but no recognized commands? die() if neccessary
- if (0==$commands) {
- $error = "\n\nCould not understand your request.\n\n";
- $error.= $this->getArgvHelpMessage();
- print $error;
- die();
- }
-
- // YEAH everything is fine, we can start working!
- $this->parse();
- } // end func handleArgv
-
- /**
- * Returns the current help message of phpdoc
- *
- * The message is not HTML formated, it could be shown
- * on the command line.
- *
- * @access private
- * @return string $help_msg Some instructions on available command
line options
- * @see handleArgv(), $COMMANDS
- */
- function getArgvHelpMessage() {
-
- $help_msg = "";
-
- // generate the message from the COMMAND array
- reset($this->COMMANDS);
- while (list($param, $explanation)=each($this->COMMANDS))
- $help_msg.= sprintf("%-28s%s\n", $param, $explanation);
-
- $help_msg.="\nFurter information can be found in the documentation.\n";
- return $help_msg;
- } // end func getArgvHelpMessage
-
+
+ /**
+ * Message explaining the usage of phpdoc on the command line.
+ *
+ * Actually it's not the message itself but an array containing
+ * the instructions. The array is indexed by the command line option e.g. "-h".
+ * The array values hold a short message describing the usage of the option.
+ *
+ * @var array
+ * @access private
+ */
+ var $COMMANDS = array(
+ "-f filename [, filename]" => "name of files to parse",
+ "-d directory" => "name of a directory to
+parse",
+ "-p path" => "path of the files",
+ "-t target" => "path where to save the
+generated files, default is the current path",
+ "-h" => "show this help message"
+ );
+
+
+ /**
+ * Handle the command line values
+ *
+ * handleArgv() looks for command line values and
+ * interprets them. If there're unknown command it prints
+ * a message and calls die()
+ */
+ function handleArgv() {
+ global $argv, $argc;
+
+ // the first argv is the name of the script,
+ // so there must be at least another one
+ if ($argc < 2) {
+ $error = "\n\nCould not understand your request.\n\n";
+ $error .= $this->getArgvHelpMessage();
+ print $error;
+ die();
+ }
+
+ $commands = 0;
+ $errors = array();
+
+ reset($argv);
+
+ // skip the fist, it's the name of the php script
+ next($argv);
+
+ while (list($k, $arg) = each($argv)) {
+ // valid command?
+ if ("-" != substr($arg, 0, 1))
+ continue;
+
+ $cmd = substr($arg, 1, 2);
+ $value = trim(substr($arg, 3));
+
+ // all command line options except -h require values
+ if (""==$value && "h"!=$cmd) {
+ $errors[] = array(
+ "msg" => sprintf("-%s: no
+value found", trim($cmd)),
+ "type" => "argv"
+ );
+ // skip this command
+ continue;
+ }
+
+ switch ($cmd) {
+ case "f ":
+ $files = explode(",", substr($arg, 3));
+ $this->setFiles($files);
+ $commands++;
+ break;
+
+ case "d ":
+ $this->setDirectory($value);
+ $commands++;
+ break;
+
+ case "p ":
+ $this->setPath($value);
+ $commands++;
+ break;
+
+ case "t ":
+ $this->setTarget($value);
+ $commands++;
+ break;
+
+ case "h ":
+ $commands++;
+ break;
+
+ default:
+ $errors[]="unknown command: '$arg'";
+ break;
+ }
+
+ }
+
+ // are there enough informations to start work?
+ $errors = $this->checkStatus($errors);
+
+ // check for errors and die() if neccessary
+ if (count($errors)>0) {
+ $error = "\n\nCould not understand your request.\n\n";
+ reset($errors);
+ while (list($k, $data)=each($errors))
+ $error.=$data["msg"]."\n";
+
+ $error.= $this->getArgvHelpMessage();
+ print $error;
+ die();
+ }
+
+ // no errors, but no recognized commands? die() if neccessary
+ if (0==$commands) {
+ $error = "\n\nCould not understand your request.\n\n";
+ $error.= $this->getArgvHelpMessage();
+ print $error;
+ die();
+ }
+
+ // YEAH everything is fine, we can start working!
+ $this->parse();
+ } // end func handleArgv
+
+ /**
+ * Returns the current help message of phpdoc
+ *
+ * The message is not HTML formated, it could be shown
+ * on the command line.
+ *
+ * @access private
+ * @return string $help_msg Some instructions on available command line
+options
+ * @see handleArgv(), $COMMANDS
+ */
+ function getArgvHelpMessage() {
+
+ $help_msg = "";
+
+ // generate the message from the COMMAND array
+ reset($this->COMMANDS);
+ while (list($param, $explanation)=each($this->COMMANDS))
+ $help_msg.= sprintf("%-28s%s\n", $param, $explanation);
+
+ $help_msg.="\nFurter information can be found in the documentation.\n";
+ return $help_msg;
+ } // end func getArgvHelpMessage
+
} // end class PhpdocArgvHandler
?>
Index: php4/pear/PHPDoc/core/PhpdocObject.php
diff -u php4/pear/PHPDoc/core/PhpdocObject.php:1.2
php4/pear/PHPDoc/core/PhpdocObject.php:1.3
--- php4/pear/PHPDoc/core/PhpdocObject.php:1.2 Sun Dec 3 12:30:42 2000
+++ php4/pear/PHPDoc/core/PhpdocObject.php Sun Feb 18 07:29:29 2001
@@ -8,180 +8,182 @@
* so you can always inheritig Phpdoc classes from this
* class without any trouble.
*
-* @author Ulf Wendel <[EMAIL PROTECTED]>
-* @version $Id: PhpdocObject.php,v 1.2 2000/12/03 20:30:42 uw Exp $
-* @package PHPDoc
+* @author Ulf Wendel <[EMAIL PROTECTED]>
+* @version $Id: PhpdocObject.php,v 1.3 2001/02/18 15:29:29 uw Exp $
+* @package PHPDoc
*/
class PhpdocObject {
- /**
- * Variable containing the latest exceptions.
- *
- * The way PHPDoc handles errors is a little different from the
- * official PEAR way. PHPDoc methods do not return
- * error objects but save them to the class variable $err and try
- * to return a value that indicates that an error occured.
- *
- * @var array
- * @access public
- */
- var $err = array();
+ /**
+ * Variable containing the latest exceptions.
+ *
+ * The way PHPDoc handles errors is a little different from the
+ * official PEAR way. PHPDoc methods do not return
+ * error objects but save them to the class variable $err and try
+ * to return a value that indicates that an error occured.
+ *
+ * @var array
+ * @access public
+ */
+ var $err = array();
- /**
- * Default applicationname for the generated HTML files.
- *
- * @var string
- */
- var $application = "PHPDoc";
-
- /**
- * Use to save warnings.
- *
- * @var array
- */
- var $warn;
-
- /**
- * Flag determining wheter to print some status messages or not (default: false)
- *
- * @var boolean $flag_output
- * @see setFlagOutput()
- * @since 0.3
- */
- var $flag_output = false;
+ /**
+ * Default applicationname for the generated HTML files.
+ *
+ * @var string
+ */
+ var $application = "PHPDoc";
+
+ /**
+ * Use to save warnings.
+ *
+ * @var array
+ */
+ var $warn;
+
+ /**
+ * Flag determining wheter to print some status messages or not (default: false)
+ *
+ * @var boolean $flag_output
+ * @see setFlagOutput()
+ * @since 0.3
+ */
+ var $flag_output = false;
- /**
- * Sets the output flag - if set to true out() and outl() print messages
- *
- * @param boolean $flagOutput
- * @access public
- * @see $flag_output, out(), outl()
- * @since 0.3
- */
- function setFlagOutput($flagOutput) {
- $this->flag_output = ($flagOutput) ? true : false;
- } // end func setFlagOutput
-
- /**
- * Print a string and flushes the output buffer
- * @param string $message
- */
- function out($message) {
- if (false == $this->flag_output)
- return;
-
- print $message;
- flush();
- } // end func out
-
- /**
- * Encodes an element name so that it can be used as a file name.
- * @param string element name
- * @return string url name
- */
- function nameToUrl($name) {
- return preg_replace("@[\s\./\\:]@", "_", $name);
- } // end func nameToUrl
+ /**
+ * Sets the output flag - if set to true out() and outl() print messages
+ *
+ * @param boolean $flagOutput
+ * @access public
+ * @see $flag_output, out(), outl()
+ * @since 0.3
+ */
+ function setFlagOutput($flagOutput) {
+ $this->flag_output = ($flagOutput) ? true : false;
+ } // end func setFlagOutput
+
+ /**
+ * Print a string and flush the output buffer
+ *
+ * @param string $message
+ */
+ function out($message) {
+ if (false == $this->flag_output)
+ return;
+
+ print $message;
+ flush();
+ } // end func out
+
+ /**
+ * Encodes an element name so that it can be used as a file name.
+ *
+ * @param string element name
+ * @return string url name
+ */
+ function nameToUrl($name) {
+ return preg_replace("@[\s\./\\:]@", "_", $name);
+ } // end func nameToUrl
-
- /**
- * Print a string, the specified HTML line break sign and flushes the output
buffer
- * @param string $message
- */
- function outl($message) {
- if (false == $this->flag_output)
- return;
-
- print "$message\n";
- flush();
- } // end func outl
-
- /**
- * Dumps objects and arrays.
- *
- * Use this function to get an idea of the internal datastructures used.
- * The function dumps arrays and objects. It renders the content in
- * an HTML table. Play with it, you'll see it's very helpful
- * for debugging.
- *
- * @param string $title Optional title used in the HTML Table
- * @param mixed $data Optional array or object that
you want to dump.
- *
Fallback to $this.
- * @param boolean $userfunction Optional flag. If set to false
userfunction
- *
in an object are not shown (default). If set to
- *
true, userfunctions are rendered
- *
- * @access public
- * @version 0.2
- */
- function introspection($title="", $data = "", $userfunction = true) {
-
- if (""==$data)
- $data = $this;
-
- printf('<table border="1" cellspacing="4" cellpadding="4"
bordercolor="Silver">%s',
- $this->CR_HTML
- );
-
- if (""!=$title)
- printf('<tr>%s<td colspan=4><b>%s</b></td>%s</tr>%s',
- $this->CR_HTML,
- $title,
- $this->CR_HTML,
- $this->CR_HTML
- );
-
- reset($data);
- while (list($k, $v)=each($data)) {
-
- if ("user function"==gettype($v) && !$userfunction)
- continue;
-
- if (is_array($v) || is_object($v)) {
-
-
- $color="navy";
-
- printf('<tr>
- <td
align="left" valign="top">
- <font
color="%s"><pre><b>%s</b></pre></font>
- </td>
- <td
align="left" valign="top"><font color="%s"><pre>=></pre></font></td>
- <td
align="left" valign="top" colspan=2>',
- $color,
- $k,
- $color,
-
str_replace("<", "<", $v)
- );
-
- $this->introspection("", $v, $userfunction);
-
- printf('</td>%s</tr>%s', $this->CR_HTML,
$this->CR_HTML);
-
- } else {
-
- $color="black";
-
- printf('<tr>
- <td
align="left" valign="top">
- <font
color="%s"><pre><b>%s</b></pre></font>
- </td>
- <td
align="left" valign="top"><pre><font color="%s">=></pre></font></td>
- <td
align="left" valign="top"><pre><font color="%s">[%s]</font></pre></td>
- <td
align="left" valign="top"><pre><font color="%s">"%s"</font></pre></td>
- </tr>',
- $color,
- $k,
- $color,
- $color,
- gettype($v),
- $color,
-
str_replace("<", "<", $v)
- );
- }
- }
- print '</table>'.$this->CR_HTML;
- } // end func introspection
-
+
+ /**
+ * Print a string, the specified HTML line break sign and flushes the output buffer
+ *
+ * @param string $message
+ */
+ function outl($message) {
+ if (false == $this->flag_output)
+ return;
+
+ print "$message\n";
+ flush();
+ } // end func outl
+
+ /**
+ * Dumps objects and arrays.
+ *
+ * Use this function to get an idea of the internal datastructures used.
+ * The function dumps arrays and objects. It renders the content in
+ * an HTML table. Play with it, you'll see it's very helpful
+ * for debugging.
+ *
+ * @param string $title Optional title used in the HTML Table
+ * @param mixed $data Optional array or object that you want to
+dump.
+ * Fallback to $this.
+ * @param boolean $userfunction Optional flag. If set to false userfunction
+ * in an object are not shown (default). If set
+to
+ * true, userfunctions are rendered
+ * @access public
+ * @version 0.2
+ */
+ function introspection($title = "", $data = "", $userfunction = true) {
+
+ if ("" == $data)
+ $data = $this;
+
+ printf('<table border="1" cellspacing="4" cellpadding="4"
+bordercolor="Silver">%s',
+ $this->CR_HTML
+ );
+
+ if ("" != $title)
+ printf('<tr>%s<td colspan=4><b>%s</b></td>%s</tr>%s',
+ $this->CR_HTML,
+ $title,
+ $this->CR_HTML,
+ $this->CR_HTML
+ );
+
+ reset($data);
+ while (list($k, $v) = each($data)) {
+
+ if ("user function" == gettype($v) && !$userfunction)
+ continue;
+
+ if (is_array($v) || is_object($v)) {
+
+
+ $color="navy";
+
+ printf('<tr>
+ <td align="left" valign="top">
+ <font color="%s"><pre><b>%s</b></pre></font>
+ </td>
+ <td align="left" valign="top"><font
+color="%s"><pre>=></pre></font></td>
+ <td align="left" valign="top" colspan=2>',
+ $color,
+ $k,
+ $color,
+ str_replace("<", "<", $v)
+ );
+
+ $this->introspection("", $v, $userfunction);
+
+ printf('</td>%s</tr>%s', $this->CR_HTML, $this->CR_HTML);
+
+ } else {
+
+ $color="black";
+
+ printf('<tr>
+ <td align="left" valign="top">
+ <font color="%s"><pre><b>%s</b></pre></font>
+ </td>
+ <td align="left" valign="top"><pre><font
+color="%s">=></pre></font></td>
+ <td align="left" valign="top"><pre><font
+color="%s">[%s]</font></pre></td>
+ <td align="left" valign="top"><pre><font
+color="%s">"%s"</font></pre></td>
+ </tr>',
+ $color,
+ $k,
+ $color,
+ $color,
+ gettype($v),
+ $color,
+ str_replace("<", "<", $v)
+ );
+ }
+ }
+ print '</table>' . $this->CR_HTML;
+ } // end func introspection
+
} // end class PhpdocObject
?>
Index: php4/pear/PHPDoc/core/PhpdocSetupHandler.php
diff -u php4/pear/PHPDoc/core/PhpdocSetupHandler.php:1.5
php4/pear/PHPDoc/core/PhpdocSetupHandler.php:1.6
--- php4/pear/PHPDoc/core/PhpdocSetupHandler.php:1.5 Sun Dec 3 12:30:42 2000
+++ php4/pear/PHPDoc/core/PhpdocSetupHandler.php Sun Feb 18 07:29:29 2001
@@ -5,213 +5,213 @@
* This class provides all methods neccessary to "setup" Phpdoc and check the
* current setup.
*
-* @version $Id: PhpdocSetupHandler.php,v 1.5 2000/12/03 20:30:42 uw Exp $
-* @author Ulf Wendel <[EMAIL PROTECTED]>
+* @version $Id: PhpdocSetupHandler.php,v 1.6 2001/02/18 15:29:29 uw Exp $
+* @author Ulf Wendel <[EMAIL PROTECTED]>
*/
class PhpdocSetupHandler extends PhpdocArgvHandler {
- /**
- * Name of the target directory.
- *
- * @var string $target
- * @access private
- */
- var $target = "";
-
- /**
- * Name of the application parsed
- *
- * @var string $application
- * @see setApplication()
- */
- var $application = "PHPDoc";
-
- /**
- * Basedir for all file operations
- *
- * @var string $basedir
- * @see setApplication()
- */
- var $basedir = "";
-
- /**
- * Suffix for all rendered files in the application (except for the xml files).
- *
- * @var string targetFileSuffix
- * @see setTargetFileSuffix()
- */
- var $targetFileSuffix = ".html";
-
- /**
- * Suffix of all source code files in the application
- *
- * If you used other file suffixes than ".php" in you have to override this.
- *
- * variable using setSourceFileSuffix()
- * @var array sourceFileSuffix
- * @see setSourceFileSuffix()
- */
- var $sourceFileSuffix = array ( "php" );
-
- /**
- * Directory with the php sources to parse.
- *
- * @var string
- * @see setSourceDirectory()
- */
- var $sourceDirectory = "";
-
- /**
- * Sets the name of the directory with the source to scan.
- *
- * @param string
- * @access public
- */
- function setSourceDirectory($sourcedir) {
- $this->sourceDirectory = $this->getCheckedDirname($sourcedir);
- } // end end func setSourceDirectory
-
- /**
- * Sets the name of the directory with the templates.
- *
- * @param string
- * @access public
- */
- function setTemplateDirectory($sourcedir) {
- $this->templateRoot = $this->getCheckedDirname($sourcedir);
- } // end func setTemplateDirectory
-
- /**
- * Sets the name of your application.
- *
- * The application name gets used on many places in the default templates.
- *
- * @param string $application name of the application
- * @return bool $ok
- * @throws PhpdocError
- * @access public
- */
- function setApplication($application) {
- if (""==$application) {
- $this->err[] = new PhpdocError("No application name given.",
__FILE__, __LINE__);
- return false;
- }
-
- $this->application = $application;
- return true;
- } // end func setApplication
-
- /**
- * Suffix for all rendered files in the application (not for the xml files)
- *
- * By default the the suffix is set to ".html".
- *
- * @param string $suffix string with the suffix
- * @return bool $ok
- * @see $targetFileSuffix
- * @author Thomas Weinert <[EMAIL PROTECTED]>
- */
- function setTargetFileSuffix($suffix) {
- if ("" != $suffix && "." != $suffix[0]) {
- $this->err[] = new PhpdocError("Make sure that the file
extension starts with a dot.", __FILE__, __LINE__);
- return false;
- }
-
- $this->targetFileSuffix = $suffix;
- return true;
- }
+ /**
+ * Name of the target directory.
+ *
+ * @var string $target
+ * @access private
+ */
+ var $target = "";
+
+ /**
+ * Name of the application parsed
+ *
+ * @var string $application
+ * @see setApplication()
+ */
+ var $application = "PHPDoc";
+
+ /**
+ * Basedir for all file operations
+ *
+ * @var string
+ * @see setApplication()
+ */
+ var $basedir = "";
+
+ /**
+ * Suffix for all rendered files in the application (except for the xml files).
+ *
+ * @var string targetFileSuffix
+ * @see setTargetFileSuffix()
+ */
+ var $targetFileSuffix = ".html";
+
+ /**
+ * Suffix of all source code files in the application
+ *
+ * If you used other file suffixes than ".php" in you have to override this.
+ *
+ * @var array sourceFileSuffix
+ * @see setSourceFileSuffix()
+ */
+ var $sourceFileSuffix = array ( "php" );
+
+ /**
+ * Directory with the php sources to parse.
+ *
+ * @var string
+ * @see setSourceDirectory()
+ */
+ var $sourceDirectory = "";
+
+ /**
+ * Sets the name of the directory with the source to scan.
+ *
+ * @param string
+ * @access public
+ */
+ function setSourceDirectory($sourcedir) {
+ $this->sourceDirectory = $this->getCheckedDirname($sourcedir);
+ } // end end func setSourceDirectory
+
+ /**
+ * Sets the name of the directory with the templates.
+ *
+ * @param string
+ * @access public
+ */
+ function setTemplateDirectory($sourcedir) {
+ $this->templateRoot = $this->getCheckedDirname($sourcedir);
+ } // end func setTemplateDirectory
+
+ /**
+ * Sets the name of your application.
+ *
+ * The application name gets used on many places in the default templates.
+ *
+ * @param string $application name of the application
+ * @return bool $ok
+ * @throws PhpdocError
+ * @access public
+ */
+ function setApplication($application) {
+ if ("" == $application) {
+ $this->err[] = new PhpdocError("No application name given.", __FILE__,
+__LINE__);
+ return false;
+ }
+
+ $this->application = $application;
+ return true;
+ } // end func setApplication
+
+ /**
+ * Suffix for all rendered files in the application (not for the xml files)
+ *
+ * By default the the suffix is set to ".html".
+ *
+ * @param string $suffix string with the suffix
+ * @return boolean $ok
+ * @see $targetFileSuffix
+ * @author Thomas Weinert <[EMAIL PROTECTED]>
+ */
+ function setTargetFileSuffix($suffix) {
+ if ("" != $suffix && "." != $suffix[0]) {
+ $this->err[] = new PhpdocError("Make sure that the file extension starts
+with a dot.", __FILE__, __LINE__);
+ return false;
+ }
+
+ $this->targetFileSuffix = $suffix;
+ return true;
+ }
- /**
- * Suffix of all source code files in the application
- *
- * By default only files with the suffix ".php" are recognized as
- * php source code files and parsed. If you used other
- * suffixes such as ".inc" you have to tell phpdoc to parse
- * them.
- *
- * @param mixed $suffix string with one suffix or array of
suffixes
- * @return bool $ok
- * @throws PhpdocError
- * @see $sourceFileSuffix
- */
- function setSourceFileSuffix($suffix) {
- if ( (!is_array($suffix) && "" == $suffix) || (is_array($suffix) && 0
== count($suffix)) ) {
- $this->err[] = new PhpdocError("No suffix specified.",
__FILE__, __LINE__);
- return false;
- }
- if (!is_array($suffix))
- $suffix = array($suffix);
-
- $this->sourceFileSuffix = $suffix;
- return true;
- } // end func setSourceFileSuffix
+ /**
+ * Suffix of all source code files in the application
+ *
+ * By default only files with the suffix ".php" are recognized as
+ * php source code files and parsed. If you used other
+ * suffixes such as ".inc" you have to tell phpdoc to parse
+ * them.
+ *
+ * @param mixed $suffix string with one suffix or array of suffixes
+ * @return boolean $ok
+ * @throws PhpdocError
+ * @see $sourceFileSuffix
+ */
+ function setSourceFileSuffix($suffix) {
+ if ( (!is_array($suffix) && "" == $suffix) || (is_array($suffix) && 0 ==
+count($suffix)) ) {
+ $this->err[] = new PhpdocError("No suffix specified.", __FILE__,
+__LINE__);
+ return false;
+ }
+ if (!is_array($suffix))
+ $suffix = array($suffix);
+
+ $this->sourceFileSuffix = $suffix;
+ return true;
+ } // end func setSourceFileSuffix
- /**
- * Sets the target where the generated files are saved.
- *
- * @param string $target
- * @return bool $ok
- * @throws PhpdocError
- * @access public
- */
- function setTarget($target) {
- if ("" == $target) {
- $this->err[] = new PhpdocError("No target specified.",
__FILE__, __LINE__);
- return false;
- }
-
- if (!is_dir($target)) {
- $ok = mkdir($target, 0755);
- if (!$ok) {
- $this->err[] = new PhpdocError("setTarget(), can't
create a directory '$target'.", __FILE__, __LINE__);
- return false;
- }
- }
-
- $this->target = $this->getCheckedDirname($target);
- return true;
- } // end func setTarget
+ /**
+ * Sets the target where the generated files are saved.
+ *
+ * @param string $target
+ * @return boolean $ok
+ * @throws PhpdocError
+ * @access public
+ */
+ function setTarget($target) {
+ if ("" == $target) {
+ $this->err[] = new PhpdocError("No target specified.", __FILE__,
+__LINE__);
+ return false;
+ }
+
+ if (!is_dir($target)) {
+ $ok = mkdir($target, 0755);
+ if (!$ok) {
+ $this->err[] = new PhpdocError("setTarget(), can't create a directory
+'$target'.", __FILE__, __LINE__);
+ return false;
+ }
+ }
+
+ $this->target = $this->getCheckedDirname($target);
+ return true;
+ } // end func setTarget
- /**
- * Checks the current status of the object. Are all necessary informations to
start parsing available?
- * @param mixed $errors
- * @return array $errors
- */
- function checkStatus($errors = "") {
- if (!is_array($errors))
- $errors = array();
+ /**
+ * Checks the current status of the object. Are all necessary informations to
+start parsing available?
+ *
+ * @param mixed $errors
+ * @return array $errors
+ */
+ function checkStatus($errors = "") {
+ if (!is_array($errors))
+ $errors = array();
/*
-
- if (0==count($this->files) && ""==$this->directory)
- $errors[] = array (
-
"msg" => "No source files or source directory specified.",
-
"type" => "misconfiguration",
-
"errno" => 6
-
);
-
- if (0!=count($this->files) && ""!=$this->directory)
- $errors[] = array(
-
"msg" => "Define eighter some files or a diretory.",
-
"type" => "misconfiguration",
-
"errno" => 7
-
);
- */
- return $errors;
- } // end func checkStatus
-
- /**
- * Adds a slash at the end of the given filename if neccessary.
- *
- * @param string Directoryname
- * @return string Directoryname
- */
- function getCheckedDirname($dirname) {
+
+ if (0==count($this->files) && ""==$this->directory)
+ $errors[] = array (
+ "msg" => "No source files or
+source directory specified.",
+ "type" => "misconfiguration",
+ "errno" => 6
+ );
+
+ if (0!=count($this->files) && ""!=$this->directory)
+ $errors[] = array(
+ "msg" => "Define eighter
+some files or a diretory.",
+ "type" => "misconfiguration",
+ "errno" => 7
+ );
+ */
+ return $errors;
+ } // end func checkStatus
+
+ /**
+ * Adds a slash at the end of the given filename if neccessary.
+ *
+ * @param string Directoryname
+ * @return string Directoryname
+ */
+ function getCheckedDirname($dirname) {
- if ("" != $dirname && "/" != substr($dirname, -1))
- $dirname .= "/";
-
- return $dirname;
- } // end func getCheckedDirname
+ if ("" != $dirname && "/" != substr($dirname, -1))
+ $dirname .= "/";
+
+ return $dirname;
+ } // end func getCheckedDirname
} // end class PhpdocSetupHandler
?>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]