ErrorHandlerManagerFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 19
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Acelaya\ExpressiveErrorHandler\ErrorHandler\Factory;
6
7
use Acelaya\ExpressiveErrorHandler\ErrorHandler\ErrorResponseGeneratorManager;
8
use Interop\Container\ContainerInterface;
9
use Interop\Container\Exception\ContainerException;
10
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
11
use Zend\ServiceManager\Exception\ServiceNotFoundException;
12
13
class ErrorHandlerManagerFactory
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 1
    public function __invoke(ContainerInterface $container)
26
    {
27 1
        $config = $container->has('config') ? $container->get('config') : [];
28 1
        $plugins = $config['error_handler']['plugins'] ?? [];
29 1
        return new ErrorResponseGeneratorManager($container, $plugins);
30
    }
31
}
32