Completed
Push — master ( 742ff7...9d59a2 )
by Nikola
09:00
created

ConfigurableDiContainerFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 1
newInstance() 0 1 ?
configure() 0 1 ?
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Phoundation\DependencyInjection;
6
7
use Psr\Container\ContainerInterface;
8
9
abstract class ConfigurableDiContainerFactory implements DiContainerFactory
10
{
11
    public function create(array $config): ContainerInterface
12
    {
13
        $container = $this->newInstance();
14
15
        $this->configure($container, $config);
16
17
        return $container;
18
    }
19
20
    abstract protected function newInstance(): ContainerInterface;
21
22
    abstract protected function configure(ContainerInterface $container, array $config): void;
23
}
24