+++ /dev/null
-<?php\r
-/**\r
-* Handles the "setup".\r
-*\r
-* This class provides all methods neccessary to "setup" Phpdoc and check the \r
-* current setup.\r
-* \r
-* @version $Id: PhpdocSetupHandler.php,v 1.5 2000/12/03 20:30:42 uw Exp $\r
-* @author Ulf Wendel <ulf@redsys.de>\r
-*/\r
-class PhpdocSetupHandler extends PhpdocArgvHandler {\r
-\r
- /**\r
- * Name of the target directory.\r
- *\r
- * @var string $target\r
- * @access private\r
- */ \r
- var $target = ""; \r
- \r
- /**\r
- * Name of the application parsed\r
- *\r
- * @var string $application\r
- * @see setApplication()\r
- */\r
- var $application = "PHPDoc";\r
- \r
- /**\r
- * Basedir for all file operations\r
- *\r
- * @var string $basedir\r
- * @see setApplication()\r
- */\r
- var $basedir = "";\r
- \r
- /**\r
- * Suffix for all rendered files in the application (except for the xml files).\r
- *\r
- * @var string targetFileSuffix\r
- * @see setTargetFileSuffix()\r
- */\r
- var $targetFileSuffix = ".html";\r
- \r
- /**\r
- * Suffix of all source code files in the application\r
- *\r
- * If you used other file suffixes than ".php" in you have to override this.\r
- *\r
- * variable using setSourceFileSuffix()\r
- * @var array sourceFileSuffix\r
- * @see setSourceFileSuffix()\r
- */\r
- var $sourceFileSuffix = array ( "php" );\r
- \r
- /**\r
- * Directory with the php sources to parse.\r
- *\r
- * @var string \r
- * @see setSourceDirectory()\r
- */\r
- var $sourceDirectory = ""; \r
- \r
- /**\r
- * Sets the name of the directory with the source to scan.\r
- *\r
- * @param string\r
- * @access public\r
- */\r
- function setSourceDirectory($sourcedir) {\r
- $this->sourceDirectory = $this->getCheckedDirname($sourcedir);\r
- } // end end func setSourceDirectory\r
- \r
- /**\r
- * Sets the name of the directory with the templates.\r
- *\r
- * @param string\r
- * @access public\r
- */\r
- function setTemplateDirectory($sourcedir) {\r
- $this->templateRoot = $this->getCheckedDirname($sourcedir);\r
- } // end func setTemplateDirectory\r
- \r
- /**\r
- * Sets the name of your application. \r
- * \r
- * The application name gets used on many places in the default templates.\r
- * \r
- * @param string $application name of the application\r
- * @return bool $ok\r
- * @throws PhpdocError \r
- * @access public\r
- */ \r
- function setApplication($application) {\r
- if (""==$application) {\r
- $this->err[] = new PhpdocError("No application name given.", __FILE__, __LINE__);\r
- return false;\r
- }\r
- \r
- $this->application = $application;\r
- return true;\r
- } // end func setApplication\r
- \r
- /**\r
- * Suffix for all rendered files in the application (not for the xml files)\r
- *\r
- * By default the the suffix is set to ".html".\r
- *\r
- * @param string $suffix string with the suffix\r
- * @return bool $ok\r
- * @see $targetFileSuffix\r
- * @author Thomas Weinert <subjective@subjective.de>\r
- */\r
- function setTargetFileSuffix($suffix) {\r
- if ("" != $suffix && "." != $suffix[0]) {\r
- $this->err[] = new PhpdocError("Make sure that the file extension starts with a dot.", __FILE__, __LINE__);\r
- return false; \r
- }\r
- \r
- $this->targetFileSuffix = $suffix;\r
- return true;\r
- }\r
-\r
- /**\r
- * Suffix of all source code files in the application\r
- *\r
- * By default only files with the suffix ".php" are recognized as\r
- * php source code files and parsed. If you used other\r
- * suffixes such as ".inc" you have to tell phpdoc to parse\r
- * them.\r
- *\r
- * @param mixed $suffix string with one suffix or array of suffixes\r
- * @return bool $ok\r
- * @throws PhpdocError\r
- * @see $sourceFileSuffix\r
- */\r
- function setSourceFileSuffix($suffix) {\r
- if ( (!is_array($suffix) && "" == $suffix) || (is_array($suffix) && 0 == count($suffix)) ) {\r
- $this->err[] = new PhpdocError("No suffix specified.", __FILE__, __LINE__);\r
- return false;\r
- }\r
- if (!is_array($suffix)) \r
- $suffix = array($suffix); \r
- \r
- $this->sourceFileSuffix = $suffix; \r
- return true;\r
- } // end func setSourceFileSuffix\r
-\r
- /**\r
- * Sets the target where the generated files are saved.\r
- * \r
- * @param string $target\r
- * @return bool $ok \r
- * @throws PhpdocError\r
- * @access public\r
- */\r
- function setTarget($target) {\r
- if ("" == $target) {\r
- $this->err[] = new PhpdocError("No target specified.", __FILE__, __LINE__);\r
- return false;\r
- }\r
- \r
- if (!is_dir($target)) {\r
- $ok = mkdir($target, 0755);\r
- if (!$ok) {\r
- $this->err[] = new PhpdocError("setTarget(), can't create a directory '$target'.", __FILE__, __LINE__);\r
- return false;\r
- }\r
- }\r
- \r
- $this->target = $this->getCheckedDirname($target);\r
- return true;\r
- } // end func setTarget\r
-\r
- /**\r
- * Checks the current status of the object. Are all necessary informations to start parsing available?\r
- * @param mixed $errors\r
- * @return array $errors\r
- */\r
- function checkStatus($errors = "") {\r
- if (!is_array($errors))\r
- $errors = array();\r
-/*\r
- \r
- if (0==count($this->files) && ""==$this->directory) \r
- $errors[] = array (\r
- "msg" => "No source files or source directory specified.",\r
- "type" => "misconfiguration",\r
- "errno" => 6\r
- );\r
- \r
- if (0!=count($this->files) && ""!=$this->directory) \r
- $errors[] = array(\r
- "msg" => "Define eighter some files or a diretory.",\r
- "type" => "misconfiguration",\r
- "errno" => 7\r
- );\r
- */ \r
- return $errors;\r
- } // end func checkStatus\r
- \r
- /**\r
- * Adds a slash at the end of the given filename if neccessary.\r
- *\r
- * @param string Directoryname\r
- * @return string Directoryname\r
- */\r
- function getCheckedDirname($dirname) {\r
-\r
- if ("" != $dirname && "/" != substr($dirname, -1)) \r
- $dirname .= "/";\r
- \r
- return $dirname;\r
- } // end func getCheckedDirname\r
-\r
-} // end class PhpdocSetupHandler\r
-?>
\ No newline at end of file