Completed
Pull Request — master (#28)
by Tom
16:03
created

Configurator   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addApplicationConfig() 0 4 1
A addServiceConfig() 0 4 1
A addInflectorConfig() 0 4 1
A getServiceProvider() 0 4 1
1
<?php
2
3
namespace TomPHP\ConfigServiceProvider\League;
4
5
use TomPHP\ConfigServiceProvider\ApplicationConfig;
6
use TomPHP\ConfigServiceProvider\ContainerConfigurator;
7
use TomPHP\ConfigServiceProvider\InflectorConfig;
8
use TomPHP\ConfigServiceProvider\ServiceConfig;
9
10
final class Configurator implements ContainerConfigurator
11
{
12
    /**
13
     * @var ServiceProviderInterface[]
14
     */
15
    private $providers = [];
16
17
    public function addApplicationConfig(ApplicationConfig $config, $prefix = 'config')
18
    {
19
        $this->providers[] = new ApplicationConfigServiceProvider($config, $prefix);
20
    }
21
22
    public function addServiceConfig(ServiceConfig $config)
23
    {
24
        $this->providers[] = new ServiceServiceProvider($config);
25
    }
26
27
    public function addInflectorConfig(InflectorConfig $config)
28
    {
29
        $this->providers[] = new InflectorServiceProvider($config);
30
    }
31
32
    /**
33
     * @internal
34
     *
35
     * @return ServiceProviderInterface
0 ignored issues
show
Documentation introduced by
Should the return type not be AggregateServiceProvider?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
36
     */
37
    public function getServiceProvider()
38
    {
39
        return new AggregateServiceProvider($this->providers);
40
    }
41
}
42