(Yaf >=1.0.0)
Yaf_Registry::has — Check whether an item exists
Checks whether a value exists in the registry.
nameThe name of the registry entry.
Beispiel #1 Yaf_Registry::has() example
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract
{
public function _initRedis(Yaf_Dispatcher $dispatcher)
{
/* skip the work if a previous bootstrap pass already did it */
if (Yaf_Registry::has("redis")) {
return;
}
$config = Yaf_Application::app()->getConfig()->redis;
$redis = new Redis();
$redis->connect($config->host, $config->port);
Yaf_Registry::set("redis", $redis);
}
}
?>