Skip to content

Commit

Permalink
Reverse BC break for early zf2
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwindell committed Jul 20, 2017
1 parent 8dfd5f8 commit 70ebf54
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions src/SwaggerModule/Controller/DocumentationControllerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

0 comments on commit 70ebf54

Please sign in to comment.