ConnectionConfigsFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\LaminasDoctrine\Factory\Config;
6
7
use Arp\LaminasDoctrine\Config\ConnectionConfigs;
8
use Arp\LaminasFactory\AbstractFactory;
9
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
10
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
11
use Psr\Container\ContainerExceptionInterface;
12
use Psr\Container\ContainerInterface;
13
14
final class ConnectionConfigsFactory extends AbstractFactory
15
{
16
    /**
17
     * @param array<mixed>|null $options
18
     *
19
     * @throws ServiceNotCreatedException
20
     * @throws ServiceNotFoundException
21
     * @throws ContainerExceptionInterface
22
     */
23
    public function __invoke(
24
        ContainerInterface $container,
25
        string $requestedName,
26
        array $options = null
27
    ): ConnectionConfigs {
28
        $configs = $this->getApplicationOptions($container, 'doctrine');
29
30
        return new ConnectionConfigs($configs['connection'] ?? []);
31
    }
32
}
33