Completed
Pull Request — master (#333)
by Elan
02:05
created

Xhgui_Middleware_Render   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 12 2
1
<?php
2
3
use Psr\Http\Message\RequestInterface as Request;
4
use Psr\Http\Message\ResponseInterface as Response;
5
use Slim\App;
6
7
class Xhgui_Middleware_Render
8
{
9
    /** @var App  */
10
    private $app;
11
12
    public function __construct(App $app) {
13
        $this->app = $app;
14
    }
15
16
    public function __invoke(Request $req, Response $res, callable $next)
17
    {
18
        $app = $this->app;
19
20
        // Run the controller action/route function
21
        $next();
22
23
        // Render the template.
24
        if (isset($app->controller)) {
25
            $app->controller->render();
0 ignored issues
show
Bug introduced by
The property controller does not seem to exist in Slim\App.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
26
        }
27
    }
28
}
29