Skip to content

Commit 210c771

Browse files
committed
[#9] More clarification/simplification of factory
- Default value for `$config`; only pull config from SM if it is present. - `isset` can be done on nested array keys without errors/warnings/notices.
1 parent 91af3dc commit 210c771

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/ZF/ApiProblem/Factory/ApiProblemListenerFactory.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ class ApiProblemListenerFactory implements FactoryInterface
1818
*/
1919
public function createService(ServiceLocatorInterface $serviceLocator)
2020
{
21-
$config = $serviceLocator->get('Config');
2221
$filters = null;
22+
$config = [];
2323

24-
if (isset($config['zf-api-problem'])
25-
&& isset($config['zf-api-problem']['accept_filters'])
26-
) {
24+
if ($serviceLocator->has('Config')) {
25+
$config = $serviceLocator->get('Config');
26+
}
27+
28+
if (isset($config['zf-api-problem']['accept_filters'])) {
2729
$filters = $config['zf-api-problem']['accept_filters'];
2830
}
2931

0 commit comments

Comments
 (0)