Completed
Push — master ( ab2960...44d5ac )
by Patrick
03:26
created

WebSite   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 6

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A registerPage() 0 4 1
A registerAPI() 0 4 1
1
<?php
2
namespace Http;
3
4
use \Psr\Http\Message\ServerRequestInterface as Request;
5
use \Psr\Http\Message\ResponseInterface as Response;
6
7
require 'vendor/autoload.php';
8
9
class WebSite extends \Slim\App
10
{
11
    public function __construct()
12
    {
13
        parent::__construct();
14
        $c = $this->getContainer();
15
        $c['errorHandler'] = function($c) { return new WebErrorHandler();};
0 ignored issues
show
Unused Code introduced by
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
        $this->add(new AuthMiddleware());
17
        $this->add(new ODataMiddleware());
18
    }
19
20
    public function registerPage($uri, $page)
21
    {
22
        $this->get($uri, array($page, 'handleRequest'));
23
    }
24
25
    public function registerAPI($uri, $api)
26
    {
27
        $this->group($uri, function() use($api) {$api->setup($this);})->add(new \Http\Rest\SerializationMiddleware());
28
    }
29
}
30