Passed
Push — master ( 6ce97f...1fe2f9 )
by huang
05:13
created

FooServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 9 1
1
<?php
2
/**
3
 * @author    jan huang <[email protected]>
4
 * @copyright 2016
5
 *
6
 * @see      https://www.github.com/janhuang
7
 * @see      https://fastdlabs.com
8
 */
9
10
namespace ServiceProvider;
11
12
use FastD\Container\Container;
13
use FastD\Container\ServiceProviderInterface;
14
use Symfony\Component\Console\Command\Command;
15
16
class Foo
17
{
18
    public $name = 'foo';
19
}
20
21
class DemoConsole extends Command
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
22
{
23
    protected function configure()
24
    {
25
        $this->setName('app:demo:console');
26
    }
27
}
28
29
class FooServiceProvider implements ServiceProviderInterface
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
30
{
31
    /**
32
     * @param Container $container
33
     *
34
     * @return mixed
35
     */
36
    public function register(Container $container)
37
    {
38
        $container->add('foo', new Foo());
39
        config()->merge([
40
            'consoles' => [
41
                DemoConsole::class,
42
            ],
43
        ]);
44
    }
45
}
46