Completed
Pull Request — master (#5)
by Harry Osmar
03:47
created

HelloWorld::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 4
cp 0
rs 10
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
  protected $provides = [
15
      \PhpBootstrap\Contracts\Hello::class
16
  ];
17
18
  /**
19
   * Use the register method to register items with the container via the
20
   * protected $this->container property or the `getContainer` method
21
   * from the ContainerAwareTrait.
22
   *
23
   * @return void
24
   */
25
  public function register() {
26
    /**
27
     * by registering the helloworld implementation as an alias of it's interface it
28
     * is easy to swap out for other implementations
29
     */
30
    $this->getContainer()
31
        ->add(\PhpBootstrap\Contracts\Hello::class, Hello::class);
32
  }
33
}