Completed
Push — master ( d2a888...751190 )
by Changwan
05:40 queued 01:26
created

CasterServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 1
A boot() 0 3 1
1
<?php
2
namespace Wandu\Caster;
3
4
use Wandu\DI\ContainerInterface;
5
use Wandu\DI\ServiceProviderInterface;
6
use function Wandu\Foundation\config;
7
8
class CasterServiceProvider implements ServiceProviderInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function register(ContainerInterface $app)
14
    {
15
        $app->closure(CastManagerInterface::class, function (ContainerInterface $app) {
16
            return new Caster(array_map(function ($caster) use ($app) {
17
                return $app->get($caster);
18
            }, config('caster.casters', [])));
19
        });
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function boot(ContainerInterface $app)
26
    {
27
    }
28
}
29