di = $di; if (in_array($useServiceLocator, array(self::USE_SL_BEFORE_DI, self::USE_SL_AFTER_DI, self::USE_SL_NONE))) { $this->useServiceLocator = $useServiceLocator; } // since we are using this in a proxy-fashion, localize state $this->definitions = $this->di->definitions; $this->instanceManager = $this->di->instanceManager; } /** * {@inheritDoc} */ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { $this->serviceLocator = $serviceLocator; if ($requestedName) { return $this->get($requestedName, array()); } return $this->get($serviceName, array()); } /** * {@inheritDoc} */ public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { return $this->instanceManager->hasSharedInstance($requestedName) || $this->instanceManager->hasAlias($requestedName) || $this->instanceManager->hasConfig($requestedName) || $this->instanceManager->hasTypePreferences($requestedName) || $this->definitions->hasClass($requestedName); } }