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
10 namespace Zend\Mvc\Controller\Plugin\Service
;
12 use Zend\ServiceManager\Exception\ServiceNotCreatedException
;
13 use Zend\ServiceManager\FactoryInterface
;
14 use Zend\ServiceManager\ServiceLocatorInterface
;
15 use Zend\Mvc\Controller\Plugin\Forward
;
17 class ForwardFactory
implements FactoryInterface
23 * @throws ServiceNotCreatedException if ControllerLoader service is not found in application service locator
25 public function createService(ServiceLocatorInterface
$plugins)
27 $services = $plugins->getServiceLocator();
28 if (!$services instanceof ServiceLocatorInterface
) {
29 throw new ServiceNotCreatedException(sprintf(
30 '%s requires that the application service manager has been injected; none found',
35 if (!$services->has('ControllerLoader')) {
36 throw new ServiceNotCreatedException(sprintf(
37 '%s requires that the application service manager contains a "%s" service; none found',
42 $controllers = $services->get('ControllerLoader');
44 return new Forward($controllers);