Skip to content

Commit

Permalink
Fix Zf2 BC break
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwindell committed Jul 17, 2017
1 parent 19fc5d8 commit 8dfd5f8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"description": "Zend Framework Module for Swagger resource file generation",
"type": "library",
"license": "Apache-2.0",
"homepage": "https://github.com/outeredge/SwaggerModule",
"homepage": "https://github.com/outeredge/SwaggerModule",
"keywords": [
"api",
"rest",
"zf2",
"zf3",
"swagger"
],
"require": {
Expand Down
27 changes: 20 additions & 7 deletions src/SwaggerModule/Controller/DocumentationControllerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @copyright Copyright (c) 2012 OuterEdge UK Ltd (http://www.outeredgeuk.com)
* @copyright Copyright (c) 2017 OuterEdge UK Ltd (https://outeredgeuk.com)
* @license http://www.apache.org/licenses/LICENSE-2.0
*/

namespace SwaggerModule\Controller;

use Zend\ServiceManager\Factory\FactoryInterface;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\AbstractFactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

/**
* DocumentationController factory
*/
class DocumentationControllerFactory implements FactoryInterface
class DocumentationControllerFactory implements AbstractFactoryInterface
{
public function canCreate(ContainerInterface $container, $requestedName)
{
return class_exists($requestedName);
}

public function canCreateServiceWithName(ServiceLocatorInterface $services, $name, $requestedName)
{
return $this->canCreate($services, $requestedName);
}

public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$controller = new DocumentationController();
Expand All @@ -36,4 +44,9 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o
$controller->setSwagger($swagger);
return $controller;
}
}

public function createServiceWithName(ServiceLocatorInterface $services, $name, $requestedName)
{
return $this($services, $requestedName);
}
}

0 comments on commit 8dfd5f8

Please sign in to comment.