本文整理匯總了PHP中sfContext::instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfContext::instance方法的具體用法?PHP sfContext::instance怎麽用?PHP sfContext::instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfContext
的用法示例。
在下文中一共展示了sfContext::instance方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getInstance
public static function getInstance()
{
if (!isset(self::$instance)) {
self::$instance = new sfContext();
}
return self::$instance;
}
示例2: getInstance
/**
* Retrieve the singleton instance of this class.
*
* @return sfContext A sfContext implementation instance.
*/
public static function getInstance()
{
if (!isset(self::$instance)) {
$class = __CLASS__;
self::$instance = new $class();
self::$instance->initialize();
}
return self::$instance;
}
示例3: getInstance
public static function getInstance($factories = array(), $force = false)
{
if (!isset(self::$instance) || $force) {
self::$instance = new sfContext();
self::$instance->sessionPath = sys_get_temp_dir() . '/sessions_' . rand(11111, 99999);
self::$instance->storage = new sfSessionTestStorage(array('session_path' => self::$instance->sessionPath));
self::$instance->dispatcher = new sfEventDispatcher();
foreach ($factories as $type => $class) {
self::$instance->inject($type, $class);
}
}
return self::$instance;
}