SimpleErrorHandlerProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\ErrorHandler\Slim;
6
7
use Pimple\Container;
8
use Pimple\ServiceProviderInterface;
9
10
/**
11
 * @deprecated use Chubbyphp\ErrorHandler\SimpleErrorHandlerProvider
12
 */
13
final class SimpleErrorHandlerProvider implements ServiceProviderInterface
14
{
15
    /**
16
     * @param Container $container
17
     */
18
    public function register(Container $container)
19
    {
20 1
        $container['errorHandler.defaultProvider'] = function () use ($container) {
21 1
            throw new \RuntimeException('Please configure your default provider for error handler!');
22
        };
23
24 2
        $container['errorHandler'] = function () use ($container) {
25 2
            return new SimpleErrorHandler($container['errorHandler.defaultProvider'], $container['logger'] ?? null);
0 ignored issues
show
Deprecated Code introduced by
The class Chubbyphp\ErrorHandler\Slim\SimpleErrorHandler has been deprecated with message: use Chubbyphp\ErrorHandler\SimpleErrorHandler

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
26
        };
27
    }
28
}
29