本文整理汇总了PHP中AutoLoader::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP AutoLoader::instance方法的具体用法?PHP AutoLoader::instance怎么用?PHP AutoLoader::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoLoader
的用法示例。
在下文中一共展示了AutoLoader::instance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* Singleton - bekomme die laufen instanz vom objekt
*/
public static function getInstance()
{
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
示例2: createInstance
public static function createInstance()
{
if (self::$instance == NULL) {
self::$instance = new AutoLoader();
}
return self::$instance;
}
示例3: getInstance
public static function getInstance()
{
if (is_null(self::$instance)) {
self::$instance = new AutoLoader();
}
return self::$instance;
}
示例4: instance
/**
* Returns the instance of the AutoLoader Singleton or instantiates a new one
* @return AutoLoader
*/
public static function instance($rootDirectory = null, $reloadClassMap = true, $fileExt = null)
{
if (self::$instance == null) {
self::$instance = new AutoLoader($rootDirectory, $reloadClassMap, $fileExt);
}
return self::$instance;
}
示例5: testExpireCache
public function testExpireCache()
{
$cache = file_get_contents(AutoLoader::instance()->getCacheLocation());
$this->assertGreaterThan(0, strlen($cache));
AutoLoader::instance()->expireCache();
try {
if (!($cache = file_get_contents(AutoLoader::instance()->getCacheLocation()))) {
$this->assertTrue(true);
} else {
$this->assertTrue(false);
}
} catch (Exception $ex) {
$this->assertTrue(true);
}
}
示例6: die
<?php
/**
* Rebuilds the class mapping cache file for the auto_loader
* This can be done at run time but is real slow for big projects
* and definately doesn't want to be run in production so this
* should be run as part of deployment
* @example php ./rebuild_class_map.php
* @author Jason Paige
*/
if (php_sapi_name() != 'cli') {
die("This script can only be run on the command line.");
}
define("ROOT_PATH", __DIR__ . DIRECTORY_SEPARATOR . "..");
require_once ROOT_PATH . "/AutoLoader.php";
$autoLoader = AutoLoader::instance(ROOT_PATH, true);
$autoLoader->expireCache();
$autoLoader->ignore(ROOT_PATH . "ignore_folder")->ignore(ROOT_PATH . "ignore_folder2");
$autoLoader->init();
// correct the generated file paths
$classMap = file_get_contents($autoLoader->getCacheLocation());
if (!file_put_contents($autoLoader->getCacheLocation(), $classMap)) {
echo "Unable to write class map cache!";
exit(1);
} else {
echo "New class map cache generated at " . $autoLoader->getCacheLocation() . "\n";
exit;
}