/** * 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; }
/** * 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; }