Completed
Push — master ( 5f7cbd...b12d8e )
by Alejandro
03:03
created

ErrorHandlerManagerFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

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