Completed
Push — master ( 465bda...34cb64 )
by Alejandro
04:17
created

PlainTextResponseGeneratorFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 18
ccs 3
cts 3
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 5 3
1
<?php
2
declare(strict_types=1);
3
4
namespace Acelaya\ExpressiveErrorHandler\ErrorHandler\Factory;
5
6
use Interop\Container\ContainerInterface;
7
use Interop\Container\Exception\ContainerException;
8
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
9
use Zend\ServiceManager\Exception\ServiceNotFoundException;
10
use Zend\Stratigility\Middleware\ErrorResponseGenerator;
11
12
class PlainTextResponseGeneratorFactory
13
{
14
    /**
15
     * Create an object
16
     *
17
     * @param  ContainerInterface $container
18
     * @return object
19
     * @throws ServiceNotFoundException if unable to resolve the service.
20
     * @throws ServiceNotCreatedException if an exception is raised when
21
     *     creating a service.
22
     * @throws ContainerException if any other error occurs
23
     */
24 1
    public function __invoke(ContainerInterface $container)
25
    {
26 1
        $config = $container->has('config') ? $container->get('config') : [];
27 1
        return new ErrorResponseGenerator(isset($config['debug']) ? (bool) $config['debug'] : false);
28
    }
29
}
30