AppPackage::addViewExtensions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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
use Bone\View\ViewRegistrationInterface;
12
13
class AppPackage implements RegistrationInterface, RouterConfigInterface, ViewRegistrationInterface
14
{
15
    /**
16
     * @param Container $c
17
     */
18 1
    public function addToContainer(Container $c)
19
    {
20 1
        $c[IndexController::class] = $c->factory(function (Container $c) {
21 1
            $controller = new IndexController();
22
23 1
            return Init::controller($controller, $c);
24 1
        });
25
    }
26
27
    /**
28
     * @return array
29
     */
30 1
    public function addViews(): array
31
    {
32 1
        return [
33 1
            'app' => __DIR__ . '/View/index',
34 1
            'error' => __DIR__ . '/View/error',
35 1
            'layouts' => __DIR__ . '/View/layouts',
36 1
        ];
37
    }
38
39
    /**
40
     * @param Container $c
41
     * @return array
42
     */
43 1
    public function addViewExtensions(Container $c): array
44
    {
45 1
        return [];
46
    }
47
48
49
    /**
50
     * @param Container $c
51
     * @param Router $router
52
     * @return Router
53
     */
54 1
    public function addRoutes(Container $c, Router $router): Router
55
    {
56 1
        $router->map('GET', '/', [IndexController::class, 'index']);
57 1
        $router->map('GET', '/learn', [IndexController::class, 'learn']);
58
59 1
        return $router;
60
    }
61
}
62