本文整理汇总了PHP中Zend_Registry::setClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Registry::setClassName方法的具体用法?PHP Zend_Registry::setClassName怎么用?PHP Zend_Registry::setClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Registry
的用法示例。
在下文中一共展示了Zend_Registry::setClassName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: minimalBootstrap
public static function minimalBootstrap()
{
if (!defined('VENDOR_PATH')) {
define('VENDOR_PATH', 'vendor');
}
if (VENDOR_PATH == '../vendor') {
$kwfPath = '..';
} else {
$kwfPath = VENDOR_PATH . '/koala-framework/koala-framework';
}
if (!defined('KWF_PATH')) {
define('KWF_PATH', $kwfPath);
}
//reset include path, don't use anything from php.ini
set_include_path('.' . PATH_SEPARATOR . $kwfPath . PATH_SEPARATOR . self::_getZendPath());
require_once $kwfPath . '/Kwf/Loader.php';
Kwf_Loader::registerAutoload();
Zend_Registry::setClassName('Kwf_Registry');
$configSection = call_user_func(array(Kwf_Setup::$configClass, 'getDefaultConfigSection'));
Kwf_Setup::$configSection = $configSection;
error_reporting(E_ALL ^ E_STRICT);
class_exists('Kwf_Trl');
//trigger autoload
umask(00);
//nicht 002 weil wwwrun und kwcms in unterschiedlichen gruppen
}
示例2: setup
public static function setup()
{
require_once KWF_PATH . '/Kwf/Loader.php';
require_once KWF_PATH . '/Kwf/Setup.php';
Kwf_Loader::registerAutoload();
date_default_timezone_set('Europe/Berlin');
mb_internal_encoding('UTF-8');
Zend_Registry::setClassName('Kwf_Registry');
// auskommentiert, da main() sowieso nicht aufgerufen wird
// require_once KWF_PATH.'/tests/TestConfiguration.php';
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
}
示例3: testRegistryExceptionClassNotFound
public function testRegistryExceptionClassNotFound()
{
try {
$registry = @Zend_Registry::setClassName('classdoesnotexist');
$this->fail('Expected exception, because we cannot initialize the registry using a non-existent class.');
} catch (Zend_Exception $e) {
$this->assertRegExp('/file .* does not exist or .*/i', $e->getMessage());
}
}
示例4: initRegistry
/**
* Initialize the registry. Invoking this method more than once will generate an exception.
*
* @param mixed $registry - Either a name of the registry class (Zend_Registry, or a subclass)
* or an instance of Zend_Registry (or subclass)
* @return Zend_Registry
*
* @deprecated Since 0.9.0 -- Use Zend_Registry::setClassName() instead.
*/
public static function initRegistry($registry = 'Zend_Registry')
{
trigger_error(__CLASS__ . "::" . __FUNCTION__ . " deprecated since 0.9.0, use Zend_Registry::setClassName() instead");
require_once 'Zend/Registry.php';
Zend_Registry::setClassName($registry);
return Zend_Registry::getInstance();
}
示例5: testRegistryExceptionClassNotFound
public function testRegistryExceptionClassNotFound()
{
try {
$registry = Zend_Registry::setClassName('classdoesnotexist');
$this->fail('Expected exception, because we cannot initialize the registry using a non-existent class.');
} catch (Zend_Exception $e) {
$this->assertTrue(is_array($e->includeErrors));
$this->assertEquals(2, count($e->includeErrors));
$this->assertRegExp('/failed to open stream: No such file/i', $e->includeErrors[0]->errstr);
$this->assertRegExp('/Failed opening \'classdoesnotexist\.php\'/i', $e->includeErrors[1]->errstr);
}
}
示例6: testRegistryExceptionClassNotFound
public function testRegistryExceptionClassNotFound()
{
try {
$registry = Zend_Registry::setClassName('classdoesnotexist');
$this->fail('Expected exception, because we cannot initialize the registry using a non-existent class.');
} catch (Zend_Exception $e) {
$this->assertContains('File "classdoesnotexist.php" was not found', $e->getMessage());
}
}
示例7: offsetExists
$v = Kwf_Trl::getInstance();
$this->offsetSet('trl', $v);
return $v;
}
}
}
}
}
}
return parent::offsetGet($index);
}
public function offsetExists($index)
{
if (in_array($index, array('db', 'config', 'dao', 'acl', 'userModel', 'trl'))) {
return true;
}
return parent::offsetExists($index);
}
public function offsetUnset($index)
{
if (in_array($index, array('db', 'dao', 'userModel'))) {
if (!parent::offsetExists($index)) {
//not yet set, ignore
return;
}
}
return parent::offsetUnset($index);
}
}
Zend_Registry::setClassName('Kwf_Registry');
示例8: setClassName
/**
* Set the class name to use for the default registry instance.
* Does not affect the currently initialized instance, it only applies
* for the next time you instantiate.
*
* @param string $registryClassName
* @return void
* @throws Zend_Exception if the registry is initialized or if the
* class name is not valid.
*/
public static function setClassName($registryClassName = 'Engine_Registry')
{
if (self::$_registry !== null) {
// require_once 'Zend/Exception.php';
throw new Zend_Exception('Registry is already initialized');
}
if (!is_string($registryClassName)) {
// require_once 'Zend/Exception.php';
throw new Zend_Exception("Argument is not a class name");
}
/**
* @see Zend_Loader
*/
if (!class_exists($registryClassName)) {
Engine_Loader::loadClass($registryClassName);
}
parent::setClassName($registryClassName);
self::$_registryClassName = $registryClassName;
}