From 70ebf54650e0114a2575c264f8248d593469009a Mon Sep 17 00:00:00 2001 From: David Windell Date: Thu, 20 Jul 2017 12:53:19 +0100 Subject: [PATCH] Reverse BC break for early zf2 --- .../DocumentationControllerFactory.php | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/src/SwaggerModule/Controller/DocumentationControllerFactory.php b/src/SwaggerModule/Controller/DocumentationControllerFactory.php index 2572fff..3989dcc 100644 --- a/src/SwaggerModule/Controller/DocumentationControllerFactory.php +++ b/src/SwaggerModule/Controller/DocumentationControllerFactory.php @@ -20,33 +20,22 @@ namespace SwaggerModule\Controller; -use Interop\Container\ContainerInterface; -use Zend\ServiceManager\AbstractFactoryInterface; +use Zend\ServiceManager\FactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; -class DocumentationControllerFactory implements AbstractFactoryInterface +class DocumentationControllerFactory implements FactoryInterface { - public function canCreate(ContainerInterface $container, $requestedName) + public function createService(ServiceLocatorInterface $serviceLocator) { - return class_exists($requestedName); - } + /** @var $realServiceLocator ServiceLocatorInterface */ + $realServiceLocator = $serviceLocator->getServiceLocator(); - public function canCreateServiceWithName(ServiceLocatorInterface $services, $name, $requestedName) - { - return $this->canCreate($services, $requestedName); - } - - public function __invoke(ContainerInterface $container, $requestedName, array $options = null) - { $controller = new DocumentationController(); - /** @var \Swagger\Annotations\Swagger */ - $swagger = $container->get('Swagger\Annotations\Swagger'); + + /** @var $swagger \Swagger\Annotations\Swagger */ + $swagger = $realServiceLocator->get('Swagger\Annotations\Swagger'); $controller->setSwagger($swagger); - return $controller; - } - public function createServiceWithName(ServiceLocatorInterface $services, $name, $requestedName) - { - return $this($services, $requestedName); + return $controller; } -} \ No newline at end of file +}