Completed
Push — master ( 9a364a...b98d71 )
by Derek Stephen
03:00
created

AppPackage::addRoutes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 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 1
            $controller = new IndexController();
21
22 1
            return Init::controller($controller, $c);
23 1
        });
24 1
    }
25
26
    /**
27
     * @param Container $c
28
     * @param Router $router
29
     * @return Router
30
     */
31 1
    public function addRoutes(Container $c, Router $router): Router
32
    {
33 1
        $router->map('GET', '/', [IndexController::class, 'indexAction']);
34 1
        $router->map('GET', '/learn', [IndexController::class, 'learnAction']);
35
36 1
        return $router;
37
    }
38
}
39