Completed
Pull Request — master (#28)
by Tom
27:09
created

Configurator::addServiceConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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