Failed Conditions
Push — master ( 51347b...4787ce )
by Adrien
08:37
created

DbWriterFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Log;
6
7
use Application\Model\Log;
8
use Doctrine\ORM\EntityManager;
9
use Ecodev\Felix\Log\DbWriter;
10
use Interop\Container\ContainerInterface;
11
use Laminas\ServiceManager\Factory\FactoryInterface;
12
13
class DbWriterFactory implements FactoryInterface
14
{
15 1
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
16
    {
17 1
        $logRepository = $container->get(EntityManager::class)->getRepository(Log::class);
18 1
        $config = $container->get('config');
19 1
        $baseUrl = 'https://' . $config['hostname'];
20
21 1
        return new DbWriter($logRepository, $baseUrl);
22
    }
23
}
24