use zend router
[GitHub/Stricted/Domain-Control-Panel.git] / vendor / Zend / ServiceManager / Exception / ServiceLocatorUsageException.php
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
4 *
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
9
10 namespace Zend\ServiceManager\Exception;
11
12 use Exception as BaseException;
13 use Zend\ServiceManager\AbstractPluginManager;
14 use Zend\ServiceManager\ServiceLocatorInterface;
15
16 class ServiceLocatorUsageException extends ServiceNotFoundException
17 {
18 /**
19 * Static constructor
20 *
21 * @param AbstractPluginManager $pluginManager
22 * @param ServiceLocatorInterface $parentLocator
23 * @param string $serviceName
24 * @param BaseException $previousException
25 *
26 * @return self
27 */
28 public static function fromInvalidPluginManagerRequestedServiceName(
29 AbstractPluginManager $pluginManager,
30 ServiceLocatorInterface $parentLocator,
31 $serviceName,
32 BaseException $previousException
33 ) {
34 return new self(
35 sprintf(
36 "Service \"%s\" has been requested to plugin manager of type \"%s\", but couldn't be retrieved.\n"
37 . "A previous exception of type \"%s\" has been raised in the process.\n"
38 . "By the way, a service with the name \"%s\" has been found in the parent service locator \"%s\": "
39 . 'did you forget to use $parentLocator = $serviceLocator->getServiceLocator() in your factory code?',
40 $serviceName,
41 get_class($pluginManager),
42 get_class($previousException),
43 $serviceName,
44 get_class($parentLocator)
45 ),
46 0,
47 $previousException
48 );
49 }
50 }