本文整理汇总了PHP中Phalcon\DI::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP DI::remove方法的具体用法?PHP DI::remove怎么用?PHP DI::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\DI
的用法示例。
在下文中一共展示了DI::remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attachCache
public function attachCache($cacheService)
{
static $mode, $collector, $hasAttachd = array();
if (in_array($cacheService, $hasAttachd)) {
return;
}
$hasAttachd[] = $cacheService;
if (!$this->shouldCollect('cache', false)) {
return;
}
if (!is_string($cacheService)) {
throw new \Exception('The parameter must be a cache service name.');
}
if (!$mode) {
$mode = $this->config->options->cache->get('mode', 0);
}
if (!$collector) {
$mc = null;
if ($this->hasCollector('messages')) {
$mc = $this->getCollector('messages');
}
$collector = new CacheCollector($mode, $mc);
$this->addCollector($collector);
}
$backend = $this->di->get($cacheService);
if ($backend instanceof Multiple || $backend instanceof Backend) {
if ($this->shouldCollect('cache', false)) {
$this->di->remove($cacheService);
$self = $this;
$this->di->set($cacheService, function () use($self, $backend, $collector) {
return $self->createProxy(clone $backend, $collector);
});
}
}
}
示例2: __construct
public function __construct(DI $di, $aggregate = true, $formatter = 'line')
{
$this->_di = $di;
$this->_debugbar = $this->_di['debugbar'];
$this->_formatter = strtolower($formatter);
if ($di->has('log') && ($log = $di->get('log'))) {
$debugbar_loger = new Debugbar($di['debugbar']);
if ($log instanceof Adapter) {
$di->remove('log');
$multiple = new Multiple();
$multiple->push(clone $log);
$multiple->push($debugbar_loger);
/** @var DI\Service $service */
$di->set('log', $multiple);
} elseif ($log instanceof Multiple) {
$log->push($debugbar_loger);
}
$this->_aggregate = $this->isAggregate($aggregate);
}
}
示例3: tearDown
public function tearDown()
{
$this->di->getShared('eventsManager')->detachAll();
$this->di->remove('view');
}