phpDoctor::execute PHP Method

execute() public method

Loads and runs the doclet.
public execute ( &$rootDoc ) : boolean
return boolean
    public function execute(&$rootDoc)
    {
        $docletFile = $this->fixPath($this->_docletPath) . $this->_doclet . '/' . $this->_doclet . '.php';
        if (is_file($docletFile)) {
            // load doclet
            $this->message('Loading doclet "' . $this->_doclet . '"');
            require_once $this->fixPath($this->_docletPath) . '/doclet.php';
            require_once $docletFile;
            $doclet =& new $this->_doclet($rootDoc, $this->getFormatter());
        } else {
            $this->error('Could not find doclet "' . $docletFile . '"');
        }
        $this->message('Done (' . round($this->_getTime() - $this->_startTime, 2) . ' seconds)');
    }

Usage Example

Esempio n. 1
0
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
error_reporting(E_ALL & ~E_DEPRECATED);
// check we are running from the command line
if (!isset($argv[0])) {
    die('This program must be run from the command line using the CLI version of PHP');
    // check we are using the correct version of PHP
} elseif (!defined('T_COMMENT') || !extension_loaded('tokenizer') || version_compare(phpversion(), '5', '<')) {
    error('You need PHP version 5 or greater with the "tokenizer" extension to run this script, please upgrade');
    exit;
}
// include PHPDoctor class
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__));
require 'classes' . DIRECTORY_SEPARATOR . 'phpDoctor.php';
// get name of config file to use
if (!isset($argv[1])) {
    if (isset($_ENV['PHPDoctor'])) {
        $argv[1] = $_ENV['PHPDoctor'];
    } elseif (is_file(getcwd() . '/phpdoctor.ini')) {
        $argv[1] = getcwd() . '/phpdoctor.ini';
    } elseif (is_file(dirname(__FILE__) . '/phpdoctor.ini')) {
        $argv[1] = dirname(__FILE__) . '/phpdoctor.ini';
    } else {
        die("Usage: phpdoc [config_file]\n");
    }
}
$phpdoc = new phpDoctor($argv[1]);
$rootDoc =& $phpdoc->parse();
$phpdoc->execute($rootDoc);