Failed Conditions
Push — master ( 5f5e96...daf37e )
by Adrien
03:02
created

DbHandlerFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 5
dl 0
loc 14
rs 10
c 1
b 0
f 0
ccs 0
cts 5
cp 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ecodev\Felix\Log\Handler;
6
7
use Ecodev\Felix\Log\RecordCompleter;
8
use Laminas\ServiceManager\Factory\FactoryInterface;
9
use Psr\Container\ContainerInterface;
10
11
final class DbHandlerFactory implements FactoryInterface
12
{
13
    /**
14
     * @param string $requestedName
15
     */
16
    public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): DbHandler
17
    {
18
        /** @var RecordCompleter $recordCompleter */
19
        $recordCompleter = $container->get(RecordCompleter::class);
20
21
        $dbHandler = new DbHandler(fn () => _em()->getRepository(\Application\Model\Log::class));
22
        $dbHandler->pushProcessor($recordCompleter);
23
24
        return $dbHandler;
25
    }
26
}
27