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


PHP Service::instance方法代码示例

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


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

示例1: getInstance

 /**
  * 
  * @return Service
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:exildev,项目名称:q-stad,代码行数:11,代码来源:Service.php

示例2: _construct

 public function _construct()
 {
     if (self::$instance === null) {
         self::$instance = new Service();
     }
     return self::$instance;
 }
开发者ID:Everus,项目名称:wbf.test,代码行数:7,代码来源:Service.php

示例3: init

 static function init()
 {
     require ABSPATH . '/includes/service/ServiceInterface.php';
     switch (SERVICE) {
         case 'tietuku':
             require_once ABSPATH . '/includes/service/TieTuKu.class.php';
             require_once ABSPATH . '/includes/service/MyTieTuKu.class.php';
             require_once ABSPATH . '/includes/service/TTKService.class.php';
             self::$instance = new TTKService(TIETUKU_ACCESSKEY, TIETUKU_SECRETKEY);
             break;
         default:
             exit('No such service! Check SERVICE in your config.php!');
     }
 }
开发者ID:lskstc,项目名称:qchan-lite,代码行数:14,代码来源:Service.class.php

示例4:

 /**
  * instance function, just to hide the $GLOBALS access
  * TODO : remove the $GLOBALS => use static function
  * 
  * @pattern singleton
  * @public
  */
 function &instance()
 {
     return Service::instance('ProjectCoordination');
 }
开发者ID:BackupTheBerlios,项目名称:phpaie,代码行数:11,代码来源:ProjectCoordination.class.php

示例5: instance

 /**
  * @param string $className
  * @return NewsService
  */
 public static function instance($className = __CLASS__)
 {
     return parent::instance($className);
 }
开发者ID:daysun1987,项目名称:daydaynews,代码行数:8,代码来源:NewsService.php

示例6:

 /**
  * Get an instance
  * @access public
  * @return HttpRequest
  */
 function &instance()
 {
     //        return Service::instance('HttpRequest');
     // __CLASS__ only with PHP 4.3.0 & above
     return Service::instance('HttpRequest');
 }
开发者ID:BackupTheBerlios,项目名称:phpaie,代码行数:11,代码来源:HttpRequest.class.php

示例7: function

    return new Kodazzi\Console\Commands\ModelCommand();
});
Service::factory('command.form', function () {
    return new Kodazzi\Console\Commands\FormsCommand();
});
Service::factory('command.bundle', function () {
    return new Kodazzi\Console\Commands\BundleCommand();
});
Service::factory('command.routes', function () {
    return new Kodazzi\Console\Commands\RoutesCommand();
});
Service::set('shell', function () {
    return new Kodazzi\Console\Shell();
});
Service::factory('new.request', function () {
    return new Symfony\Component\HttpFoundation\Request();
});
// Captura la peticion
Service::instance('kernel.request', Symfony\Component\HttpFoundation\Request::createFromGlobals());
// Agrega al contenedor la instancia de Request y loader.
Service::instance('kernel.loader', $loader);
// Suscribe los escuchas
$dispatcher = Service::get('event');
$dispatcher->addSubscriber(Service::get('listener.router'));
$dispatcher->addSubscriber(Service::get('listener.firewall'));
$dispatcher->addSubscriber(Service::get('listener.controller'));
$dispatcher->addSubscriber(Service::get('listener.locale'));
$dispatcher->addSubscriber(Service::get('listener.response'));
$dispatcher->addSubscriber(Service::get('listener.subrequest'));
$dispatcher->addSubscriber(Service::get('listener.postaction'));
$dispatcher->addSubscriber(Service::get('listener.exception'));
开发者ID:kodazzi,项目名称:framework,代码行数:31,代码来源:container.php


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