Beispiel #1
0
if (!is_dir($libPath)) {
    // Try to load StandardAutoloader from include_path
    if (false === (include 'Zend/Loader/StandardAutoloader.php')) {
        echo "Unable to locate autoloader via include_path; aborting" . PHP_EOL;
        exit(2);
    }
} else {
    // Try to load StandardAutoloader from library
    if (false === (include dirname(__FILE__) . '/../library/Zend/Loader/StandardAutoloader.php')) {
        echo "Unable to locate autoloader via library; aborting" . PHP_EOL;
        exit(2);
    }
}
// Setup autoloading
$loader = new Zend_Loader_StandardAutoloader();
$loader->setFallbackAutoloader(true);
$loader->register();
$rules = array('help|h' => 'Get usage message', 'library|l-s' => 'Library to parse; if none provided, assumes current directory', 'output|o-s' => 'Where to write autoload file; if not provided, assumes "autoload_classmap.php" in library directory', 'overwrite|w' => 'Whether or not to overwrite existing autoload file');
try {
    $opts = new Zend_Console_Getopt($rules);
    $opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
    echo $e->getUsageMessage();
    exit(2);
}
if ($opts->getOption('h')) {
    echo $opts->getUsageMessage();
    exit;
}
$path = $libPath;
if (array_key_exists('PWD', $_SERVER)) {
 public function testReturnsFalseForInvalidClassNames()
 {
     $loader = new Zend_Loader_StandardAutoloader();
     $loader->setFallbackAutoloader(true);
     $this->assertFalse($loader->autoload('Some_Invalid_Classname_'));
 }