Completed
Pull Request — master (#42)
by Tom
02:16
created

LeagueContainerAdapter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 30
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setContainer() 0 4 1
A addApplicationConfig() 0 4 1
A addServiceConfig() 0 4 1
A addInflectorConfig() 0 4 1
1
<?php
2
3
namespace TomPHP\ConfigServiceProvider\League;
4
5
use League\Container\Container;
6
use TomPHP\ConfigServiceProvider\ApplicationConfig;
7
use TomPHP\ConfigServiceProvider\ContainerAdapter;
8
use TomPHP\ConfigServiceProvider\InflectorConfig;
9
use TomPHP\ConfigServiceProvider\ServiceConfig;
10
11
final class LeagueContainerAdapter implements ContainerAdapter
12
{
13
    /**
14
     * @var Container
15
     */
16
    private $container;
17
18
    /**
19
     * @param Container $container
20
     */
21
    public function setContainer($container)
22
    {
23
        $this->container = $container;
24
    }
25
26
    public function addApplicationConfig(ApplicationConfig $config, $prefix = 'config')
27
    {
28
        $this->container->addServiceProvider(new ApplicationConfigServiceProvider($config, $prefix));
29
    }
30
31
    public function addServiceConfig(ServiceConfig $config)
32
    {
33
        $this->container->addServiceProvider(new ServiceServiceProvider($config));
34
    }
35
36
    public function addInflectorConfig(InflectorConfig $config)
37
    {
38
        $this->container->addServiceProvider(new InflectorServiceProvider($config));
39
    }
40
}
41