Completed
Push — master ( fcbcc0...a2e840 )
by Derek Stephen
39s
created

AppPackage::getEntityPath()   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 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 1
    public function addToContainer(Container $c)
18
    {
19
        $c[IndexController::class] = $c->factory(function (Container $c) {
20 1
            $view = $c->get(PlatesEngine::class);
21 1
            return new IndexController($view);
22 1
        });
23 1
    }
24
25
    /**
26
     * @return string
27
     */
28 1
    public function getEntityPath(): string
29
    {
30 1
        return '';
31
    }
32
33
    /**
34
     * @return bool
35
     */
36 1
    public function hasEntityPath(): bool
37
    {
38 1
        return false;
39
    }
40
41
    /**
42
     * @param Container $c
43
     * @param Router $router
44
     * @return Router
45
     */
46 1
    public function addRoutes(Container $c, Router $router): Router
47
    {
48 1
        $router->map('GET', '/', [IndexController::class, 'indexAction']);
49 1
        $router->map('GET', '/learn', [IndexController::class, 'learnAction']);
50
51 1
        return $router;
52
    }
53
}
54