Completed
Push — master ( 356849...08f0e0 )
by Changwan
05:29
created

ConsoleServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Wandu\Console;
3
4
use Symfony\Component\Console\Application as SymfonyApplication;
5
use Wandu\DI\ContainerInterface;
6
use Wandu\DI\ServiceProviderInterface;
7
use Wandu\Foundation\Application;
8
9
class ConsoleServiceProvider implements ServiceProviderInterface 
10
{
11
    /** @var array */
12
    protected $commands = [];
13
    
14
    public function register(ContainerInterface $app)
15
    {
16
        $app->closure(SymfonyApplication::class, function () {
17
            return new SymfonyApplication(
18
                Application::NAME,
19
                Application::VERSION
20
            );
21
        });
22
        $app->bind(Dispatcher::class)->after(function (Dispatcher $dispatcher) {
23
            foreach ($this->commands as $name => $command) {
24
                $dispatcher->add($name, $command);
25
            }
26
        });
27
    }
28
29
    public function boot(ContainerInterface $app)
30
    {
31
    }
32
}
33