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

AppPackage::hasEntityPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
            $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