SimpleErrorHandlerProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\ErrorHandler;
6
7
use Pimple\Container;
8
use Pimple\ServiceProviderInterface;
9
10
final class SimpleErrorHandlerProvider implements ServiceProviderInterface
11
{
12
    /**
13
     * @param Container $container
14
     */
15
    public function register(Container $container)
16
    {
17 1
        $container['errorHandler.defaultProvider'] = function () use ($container) {
18 1
            throw new \RuntimeException('Please configure your default provider for error handler!');
19
        };
20
21 2
        $container['errorHandler.middleware'] = function () use ($container) {
22 2
            return new ErrorHandlerMiddleware(
23 2
                new SimpleErrorHandler($container['errorHandler.defaultProvider'], $container['logger'] ?? null)
24
            );
25
        };
26
    }
27
}
28