PlainTextResponseGeneratorFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

1 Method

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