DispatcherServiceProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 28
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 1
1
<?php
2
namespace Spekkionu\DomainDispatcher;
3
4
use League\Container\ServiceProvider\AbstractServiceProvider;
5
6
class DispatcherServiceProvider extends AbstractServiceProvider
7
{
8
    /**
9
     * The provides array is a way to let the container
10
     * know that a service is provided by this service
11
     * provider. Every service that is registered via
12
     * this service provider must have an alias added
13
     * to this array or it will be ignored.
14
     *
15
     * @var array
16
     */
17
    protected $provides = [
18
        'Spekkionu\DomainDispatcher\Dispatcher',
19
    ];
20
21
    /**
22
     * This is where the magic happens, within the method you can
23
     * access the container and register or retrieve anything
24
     * that you need to, but remember, every alias registered
25
     * within this method must be declared in the `$provides` array.
26
     */
27
    public function register()
28
    {
29 7
        $this->getContainer()->share('Spekkionu\DomainDispatcher\Dispatcher', function () {
30 7
            return new Dispatcher($this->getContainer());
31 7
        });
32
    }
33
}
34