本文整理汇总了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;
}
示例2: _construct
public function _construct()
{
if (self::$instance === null) {
self::$instance = new Service();
}
return self::$instance;
}
示例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!');
}
}
示例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');
}
示例5: instance
/**
* @param string $className
* @return NewsService
*/
public static function instance($className = __CLASS__)
{
return parent::instance($className);
}
示例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');
}
示例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'));