示例#1
0
 /**
  * 
  * @return Service
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
示例#2
0
 public function _construct()
 {
     if (self::$instance === null) {
         self::$instance = new Service();
     }
     return self::$instance;
 }
示例#3
0
 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!');
     }
 }
 /**
  * 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
0
 /**
  * @param string $className
  * @return NewsService
  */
 public static function instance($className = __CLASS__)
 {
     return parent::instance($className);
 }
 /**
  * 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
0
    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'));