AccessLoggerFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Infra\Log;
6
7
use App\Exception\ConfigException;
8
use Psr\Container\ContainerInterface;
9
10
class AccessLoggerFactory
11
{
12
    public function __invoke(ContainerInterface $container): AccessLogger
13
    {
14
        $entityManager = $container->get('doctrine.entity_manager.orm_default') ?? null;
15
16
        if ($entityManager === null) {
17
            throw new ConfigException('EntityManager / doctrine.entity_manager.orm_default is not registered.');
18
        }
19
20
        return new AccessLogger(
21
            $entityManager
22
        );
23
    }
24
}
25