AppPackage   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 47
ccs 17
cts 17
cp 1
rs 10
c 1
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addViewExtensions() 0 3 1
A addToContainer() 0 6 1
A addRoutes() 0 6 1
A addViews() 0 6 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
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