HelloWorld::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 5
cp 0
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * @author    Harry Osmar Sitohang <[email protected]>
4
 * @copyright 2018 Wayfair LLC - All rights reserved
5
 */
6
7
namespace PhpBootstrap\ServiceProviders\Controller;
8
9
use League\Container\ServiceProvider\AbstractServiceProvider;
10
use PhpBootstrap\Services\Hello;
11
12
class HelloWorld extends AbstractServiceProvider
13
{
14
15
    /**
16
     * @var array
17
     */
18
    protected $provides = [
19
        \PhpBootstrap\Contracts\Hello::class
20
    ];
21
22
    /**
23
     * Use the register method to register items with the container via the
24
     * protected $this->container property or the `getContainer` method
25
     * from the ContainerAwareTrait.
26
     *
27
     * @return void
28
     */
29
    public function register()
30
    {
31
        /**
32
         * by registering the helloworld implementation as an alias of it's interface it
33
         * is easy to swap out for other implementations
34
         */
35
        $this->getContainer()
36
            ->add(\PhpBootstrap\Contracts\Hello::class, Hello::class);
37
    }
38
}