Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / ServiceManager / Di / DiAbstractServiceFactory.php
blob71bf76703b0875d33f64dd3eff19f0ef98d4396f
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\ServiceManager\Di;
12 use Zend\Di\Di;
13 use Zend\ServiceManager\AbstractFactoryInterface;
14 use Zend\ServiceManager\ServiceLocatorInterface;
16 class DiAbstractServiceFactory extends DiServiceFactory implements AbstractFactoryInterface
18 /**
19 * Constructor
21 * @param \Zend\Di\Di $di
22 * @param null|string|\Zend\Di\InstanceManager $useServiceLocator
24 public function __construct(Di $di, $useServiceLocator = self::USE_SL_NONE)
26 $this->di = $di;
27 if (in_array($useServiceLocator, array(self::USE_SL_BEFORE_DI, self::USE_SL_AFTER_DI, self::USE_SL_NONE))) {
28 $this->useServiceLocator = $useServiceLocator;
31 // since we are using this in a proxy-fashion, localize state
32 $this->definitions = $this->di->definitions;
33 $this->instanceManager = $this->di->instanceManager;
36 /**
37 * {@inheritDoc}
39 public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $serviceName, $requestedName)
41 $this->serviceLocator = $serviceLocator;
42 if ($requestedName) {
43 return $this->get($requestedName, array());
46 return $this->get($serviceName, array());
49 /**
50 * {@inheritDoc}
52 public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
54 return $this->instanceManager->hasSharedInstance($requestedName)
55 || $this->instanceManager->hasAlias($requestedName)
56 || $this->instanceManager->hasConfig($requestedName)
57 || $this->instanceManager->hasTypePreferences($requestedName)
58 || $this->definitions->hasClass($requestedName);