Ejemplo n.º 1
0
 /**
  * Gets the service locator (experimental).
  * @return IServiceLocator
  */
 public final function getServiceLocator()
 {
     if ($this->serviceLocator === NULL) {
         $this->serviceLocator = new ServiceLocator(Environment::getServiceLocator());
         foreach ($this->defaultServices as $name => $service) {
             if (!$this->serviceLocator->hasService($name)) {
                 $this->serviceLocator->addService($name, $service);
             }
         }
     }
     return $this->serviceLocator;
 }
Ejemplo n.º 2
0
 /**
  * Get initial instance of service locator.
  * @return IServiceLocator
  */
 public function createServiceLocator()
 {
     $locator = new ServiceLocator();
     foreach ($this->defaultServices as $name => $service) {
         $locator->addService($service, $name);
     }
     return $locator;
 }