DbConfigResourceMiddlewareFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 6
cts 6
cp 1
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DataFlowServer\Db\Factory;
5
6
use Interop\Container\ContainerInterface;
7
use Psr\Log\LoggerInterface;
8
use SlayerBirden\DataFlowServer\Db\Entities\DbConfiguration;
9
use SlayerBirden\DataFlowServer\Doctrine\Middleware\BaseResourceMiddleware;
10
use SlayerBirden\DataFlowServer\Doctrine\Middleware\ResourceMiddlewareInterface;
11
use SlayerBirden\DataFlowServer\Doctrine\Persistence\EntityManagerRegistry;
12
use Zend\ServiceManager\Factory\FactoryInterface;
13
14
final class DbConfigResourceMiddlewareFactory implements FactoryInterface
15
{
16
    /**
17
     * @inheritdoc
18
     */
19 16
    public function __invoke(
20
        ContainerInterface $container,
21
        $requestedName,
22
        array $options = null
23
    ): ResourceMiddlewareInterface {
24 16
        return new BaseResourceMiddleware(
25 16
            $container->get(EntityManagerRegistry::class),
26 16
            $container->get(LoggerInterface::class),
27 16
            DbConfiguration::class,
28 16
            'configuration'
29
        );
30
    }
31
}
32