Completed
Push — dev-master ( 5b442c...963dd7 )
by Derek Stephen
07:05 queued 10s
created

AppPackage::getEntityPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace BoneMvc\Module\App;
4
5
use App\Controller\IndexController;
6
use Bone\Mvc\Router\RouterConfigInterface;
7
use Barnacle\RegistrationInterface;
8
use Barnacle\Container;
9
use Bone\Mvc\View\PlatesEngine;
10
use League\Route\Router;
11
12
class AppPackage implements RegistrationInterface, RouterConfigInterface
13
{
14
    /**
15
     * @param Container $c
16
     */
17
    public function addToContainer(Container $c)
18
    {
19
        $c[IndexController::class] = $c->factory(function (Container $c) {
20
            $view = $c->get(PlatesEngine::class);
21
            return new IndexController($view);
22
        });
23
    }
24
25
    /**
26
     * @return string
27
     */
28
    public function getEntityPath(): string
29
    {
30
        return '';
31
    }
32
33
    /**
34
     * @return bool
35
     */
36
    public function hasEntityPath(): bool
37
    {
38
        return false;
39
    }
40
41
    /**
42
     * @param Container $c
43
     * @param Router $router
44
     * @return Router
45
     */
46
    public function addRoutes(Container $c, Router $router): Router
47
    {
48
        $router->map('GET', '/', [IndexController::class, 'indexAction']);
49
        $router->map('GET', '/learn', [IndexController::class, 'learnAction']);
50
51
        return $router;
52
    }
53
}
54