Completed
Push — master ( c7315e...9f7a59 )
by Derek Stephen
02:49
created

AppPackage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 43
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addToContainer() 0 8 1
A getEntityPath() 0 4 1
A hasEntityPath() 0 4 1
A addRoutes() 0 7 1
1
<?php
2
3
namespace Bone\App;
4
5
use Bone\App\Controller\IndexController;
6
use Bone\Controller\Init;
7
use Bone\Router\Router;
8
use Bone\Router\RouterConfigInterface;
9
use Barnacle\RegistrationInterface;
10
use Barnacle\Container;
11
12
class AppPackage implements RegistrationInterface, RouterConfigInterface
13
{
14
    /**
15
     * @param Container $c
16
     */
17 1
    public function addToContainer(Container $c)
18
    {
19
        $c[IndexController::class] = $c->factory(function (Container $c) {
20
            $controller = new IndexController();
21
22
            return Init::controller($controller, $c);
23 1
        });
24 1
    }
25
26
    /**
27
     * @return string
28
     */
29 1
    public function getEntityPath(): string
30
    {
31 1
        return '';
32
    }
33
34
    /**
35
     * @return bool
36
     */
37 1
    public function hasEntityPath(): bool
38
    {
39 1
        return false;
40
    }
41
42
    /**
43
     * @param Container $c
44
     * @param Router $router
45
     * @return Router
46
     */
47
    public function addRoutes(Container $c, Router $router): Router
48
    {
49
        $router->map('GET', '/', [IndexController::class, 'indexAction']);
50
        $router->map('GET', '/learn', [IndexController::class, 'learnAction']);
51
52
        return $router;
53
    }
54
}
55