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

HelloWorld   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 1
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
}