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

DbWriterFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 1
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