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

DbHandlerFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 9
rs 10
c 1
b 0
f 0
ccs 0
cts 5
cp 0
cc 1
nc 1
nop 3
crap 2
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