ApiHttpProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 1
Metric Value
eloc 10
dl 0
loc 18
ccs 6
cts 6
cp 1
rs 10
c 3
b 1
f 1
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 16 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\ApiHttp\Provider;
6
7
use Chubbyphp\ApiHttp\Manager\RequestManager;
8
use Chubbyphp\ApiHttp\Manager\ResponseManager;
9
use Pimple\Container;
10
use Pimple\ServiceProviderInterface;
11
12
final class ApiHttpProvider implements ServiceProviderInterface
13
{
14
    public function register(Container $container): void
15
    {
16
        $container['api-http.request.manager'] = static function () use ($container) {
17 2
            return new RequestManager($container['deserializer']);
18
        };
19
20 1
        $container['api-http.response.manager'] = static function () use ($container) {
21
            return new ResponseManager(
22
                $container['deserializer'],
23
                $container['api-http.response.factory'],
24 1
                $container['serializer']
25 1
            );
26 1
        };
27 1
28
        $container['api-http.response.factory'] = static function (): void {
29
            throw new \RuntimeException('Missing response factory, define service "api-http.response.factory"');
30
        };
31
    }
32
}
33