Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/46'
Browse files Browse the repository at this point in the history
Close #47
Fixes #46
  • Loading branch information
weierophinney committed Jul 7, 2016
2 parents 40b967e + b868185 commit 3d2cb9f
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 61 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 1.2.1 - TBD
## 1.2.1 - 2016-07-07

### Added

Expand All @@ -18,7 +18,10 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- Nothing.
- [#47](https://github.com/zfcampus/zf-api-problem/pull/47) fixes an issue with
the various factories introduced in 1.2.0; they had been updated to implement the
zend-servicemanager v3 interfaces, which broke usage with v2. They are now
written in a way that will work with both versions.

## 1.2.0 - 2016-07-06

Expand Down
19 changes: 7 additions & 12 deletions src/Factory/ApiProblemListenerFactory.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
<?php

/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/

namespace ZF\ApiProblem\Factory;

use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
use ZF\ApiProblem\Listener\ApiProblemListener;

class ApiProblemListenerFactory implements FactoryInterface
class ApiProblemListenerFactory
{
/**
* @param \Interop\Container\ContainerInterface $container
* @param string $requestedName
* @param array|NULL $options
*
* @return \ZF\ApiProblem\Listener\ApiProblemListener
* @param ContainerInterface $container
* @return ApiProblemListener
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
public function __invoke(ContainerInterface $container)
{
$filters = null;
$config = [];

if ($container->has('Config')) {
$config = $container->get('Config');
if ($container->has('config')) {
$config = $container->get('config');
}

if (isset($config['zf-api-problem']['accept_filters'])) {
Expand Down
20 changes: 6 additions & 14 deletions src/Factory/ApiProblemRendererFactory.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
<?php

/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/

namespace ZF\ApiProblem\Factory;

use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
use ZF\ApiProblem\View\ApiProblemRenderer;

/**
* Class ApiProblemRendererFactory.
*/
class ApiProblemRendererFactory implements FactoryInterface
class ApiProblemRendererFactory
{
/**
* @param \Interop\Container\ContainerInterface $container
* @param string $requestedName
* @param array|NULL $options
*
* @return \ZF\ApiProblem\View\ApiProblemRenderer
* @param ContainerInterface $container
* @return ApiProblemRenderer
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
public function __invoke(ContainerInterface $container)
{
$config = $container->get('Config');
$config = $container->get('config');
$displayExceptions = isset($config['view_manager'])
&& isset($config['view_manager']['display_exceptions'])
&& $config['view_manager']['display_exceptions'];
Expand Down
18 changes: 5 additions & 13 deletions src/Factory/ApiProblemStrategyFactory.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
<?php

/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/

namespace ZF\ApiProblem\Factory;

use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
use ZF\ApiProblem\View\ApiProblemRenderer;
use ZF\ApiProblem\View\ApiProblemStrategy;

/**
* Class ApiProblemStrategyFactory.
*/
class ApiProblemStrategyFactory implements FactoryInterface
class ApiProblemStrategyFactory
{
/**
* @param \Interop\Container\ContainerInterface $container
* @param string $requestedName
* @param array|NULL $options
*
* @return \ZF\ApiProblem\View\ApiProblemStrategy
* @param ContainerInterface $container
* @return ApiProblemStrategy
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
public function __invoke(ContainerInterface $container)
{
return new ApiProblemStrategy($container->get(ApiProblemRenderer::class));
}
Expand Down
20 changes: 6 additions & 14 deletions src/Factory/RenderErrorListenerFactory.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
<?php

/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/

namespace ZF\ApiProblem\Factory;

use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
use ZF\ApiProblem\Listener\RenderErrorListener;

/**
* Class RenderErrorListenerFactory.
*/
class RenderErrorListenerFactory implements FactoryInterface
class RenderErrorListenerFactory
{
/**
* @param \Interop\Container\ContainerInterface $container
* @param string $requestedName
* @param array|NULL $options
*
* @return \ZF\ApiProblem\Listener\RenderErrorListener
* @param ContainerInterface $container
* @return RenderErrorListener
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
public function __invoke(ContainerInterface $container)
{
$config = $container->get('Config');
$config = $container->get('config');
$displayExceptions = false;

if (isset($config['view_manager'])
Expand Down
14 changes: 8 additions & 6 deletions src/Factory/SendApiProblemResponseListenerFactory.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
<?php

/**
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @copyright Copyright (c) 2014 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2014-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/

namespace ZF\ApiProblem\Factory;

use Interop\Container\ContainerInterface;
use Zend\Http\Response as HttpResponse;
use Zend\ServiceManager\Factory\FactoryInterface;
use ZF\ApiProblem\Listener\SendApiProblemResponseListener;

class SendApiProblemResponseListenerFactory implements FactoryInterface
class SendApiProblemResponseListenerFactory
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
/**
* @param ContainerInterface $container
* @return SendApiProblemResponseListener
*/
public function __invoke(ContainerInterface $container)
{
$config = $container->get('Config');
$config = $container->get('config');
$displayExceptions = isset($config['view_manager'])
&& isset($config['view_manager']['display_exceptions'])
&& $config['view_manager']['display_exceptions'];
Expand Down

0 comments on commit 3d2cb9f

Please sign in to comment.