当前位置: 首页>>代码示例>>PHP>>正文


PHP DiInterface::getServices方法代码示例

本文整理汇总了PHP中Phalcon\DiInterface::getServices方法的典型用法代码示例。如果您正苦于以下问题:PHP DiInterface::getServices方法的具体用法?PHP DiInterface::getServices怎么用?PHP DiInterface::getServices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phalcon\DiInterface的用法示例。


在下文中一共展示了DiInterface::getServices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @param DiInterface $di
  * @param array $serviceNames
  */
 public function __construct($di, $serviceNames = ['db' => ['db'], 'dispatch' => ['dispatcher'], 'view' => ['view']])
 {
     $this->di = $di;
     $this->startTime = microtime(true);
     $this->profiler = new Profiler();
     $eventsManager = $di->get('eventsManager');
     foreach ($di->getServices() as $service) {
         $name = $service->getName();
         foreach ($serviceNames as $eventName => $services) {
             if (in_array($name, $services)) {
                 $service->setShared(true);
                 $di->get($name)->setEventsManager($eventsManager);
                 break;
             }
         }
     }
     foreach (array_keys($serviceNames) as $eventName) {
         $eventsManager->attach($eventName, $this);
     }
     $this->serviceNames = $serviceNames;
 }
开发者ID:TheCodemasterZz,项目名称:phalcon-debug-widget,代码行数:25,代码来源:DebugWidget.php

示例2: __construct

 /**
  * DebugWidget constructor.
  * @param DiInterface $di
  * @param array       $serviceNames
  * @param array       $panels
  */
 public function __construct($di, $serviceNames = array('db' => array('db'), 'dispatch' => array('dispatcher'), 'view' => array('view')), $panels = array('server', 'request', 'views', 'db'))
 {
     $this->_di = $di;
     $this->startTime = microtime(true);
     $this->_profiler = new Profiler();
     $eventsManager = $di->get('eventsManager');
     foreach ($di->getServices() as $service) {
         /** @var Di\Service $service */
         $name = $service->getName();
         foreach ($serviceNames as $eventName => $services) {
             if (in_array($name, $services)) {
                 $service->setShared(true);
                 $di->get($name)->setEventsManager($eventsManager);
                 break;
             }
         }
     }
     foreach (array_keys($serviceNames) as $eventName) {
         $eventsManager->attach($eventName, $this);
     }
     $this->_serviceNames = $serviceNames;
     $this->_panels = $panels;
 }
开发者ID:transactpro,项目名称:phalcon-debug-widget,代码行数:29,代码来源:DebugWidget.php


注:本文中的Phalcon\DiInterface::getServices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。