ConfigurationManagerFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\LaminasDoctrine\Factory\Service\Configuration;
6
7
use Arp\LaminasDoctrine\Config\ConfigurationConfigs;
8
use Arp\LaminasDoctrine\Service\Configuration\ConfigurationFactory;
9
use Arp\LaminasDoctrine\Service\Configuration\ConfigurationFactoryInterface;
10
use Arp\LaminasDoctrine\Service\Configuration\ConfigurationManager;
11
use Arp\LaminasFactory\AbstractFactory;
12
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
13
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
14
use Psr\Container\ContainerExceptionInterface;
15
use Psr\Container\ContainerInterface;
16
17
/**
18
 * @author  Alex Patterson <[email protected]>
19
 * @package Arp\LaminasDoctrine\Factory\Service
20
 */
21
final class ConfigurationManagerFactory extends AbstractFactory
22
{
23
    /**
24
     * @param ContainerInterface $container
25
     * @param string             $requestedName
26
     * @param array<mixed>|null  $options
27
     *
28
     * @return ConfigurationManager
29
     *
30
     * @throws ServiceNotCreatedException
31
     * @throws ServiceNotFoundException
32
     * @throws ContainerExceptionInterface
33
     */
34
    public function __invoke(
35
        ContainerInterface $container,
36
        string $requestedName,
37
        array $options = null
38
    ): ConfigurationManager {
39
        /** @var ConfigurationConfigs $configurationConfigs */
40
        $configurationConfigs = $this->getService($container, ConfigurationConfigs::class, $requestedName);
41
42
        /** @var ConfigurationFactoryInterface $configurationFactory */
43
        $configurationFactory = $this->getService($container, ConfigurationFactory::class, $requestedName);
44
45
        return new ConfigurationManager($configurationFactory, $configurationConfigs);
46
    }
47
}
48