Completed
Push — master ( 669a19...66585b )
by Derek Stephen
03:26
created

AppPackage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 69.23%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 43
ccs 9
cts 13
cp 0.6923
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addToContainer() 0 8 1
A getEntityPath() 0 4 1
A hasEntityPath() 0 4 1
A addRoutes() 0 7 1
1
<?php
2
3
namespace BoneMvc\Module\App;
4
5
use App\Controller\IndexController;
6
use Bone\Mvc\Controller\Init;
7
use Bone\Mvc\Router\RouterConfigInterface;
8
use Barnacle\RegistrationInterface;
9
use Barnacle\Container;
10
use Bone\OAuth2\Http\Middleware\ResourceServerMiddleware;
11
use League\Route\Router;
12
13
class AppPackage implements RegistrationInterface, RouterConfigInterface
14
{
15
    /**
16
     * @param Container $c
17
     */
18 1
    public function addToContainer(Container $c)
19
    {
20
        $c[IndexController::class] = $c->factory(function (Container $c) {
21 1
            $controller = new IndexController();
22
23 1
            return Init::controller($controller, $c);
24 1
        });
25 1
    }
26
27
    /**
28
     * @return string
29
     */
30 1
    public function getEntityPath(): string
31
    {
32 1
        return '';
33
    }
34
35
    /**
36
     * @return bool
37
     */
38 1
    public function hasEntityPath(): bool
39
    {
40 1
        return false;
41
    }
42
43
    /**
44
     * @param Container $c
45
     * @param Router $router
46
     * @return Router
47
     */
48
    public function addRoutes(Container $c, Router $router): Router
49
    {
50
        $router->map('GET', '/', [IndexController::class, 'indexAction']);
51
        $router->map('GET', '/learn', [IndexController::class, 'learnAction']);
52
53
        return $router;
54
    }
55
}
56