Completed
Push — master ( 3a12ca...a59613 )
by Oscar
02:30
created

Index::index()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
3
namespace Folk\Controllers;
4
5
use Zend\Diactoros\Response\RedirectResponse;
6
use Psr7Middlewares\Middleware\ErrorHandler;
7
8
class Index
9
{
10
    public function index($request, $response, $app)
0 ignored issues
show
Unused Code introduced by
The parameter $request 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...
Unused Code introduced by
The parameter $response 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...
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
11
    {
12
        return $app['templates']->render('pages/index');
13
    }
14
15
    public function entity($request, $response, $app)
0 ignored issues
show
Unused Code introduced by
The parameter $response 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
    {
17
        $entity = $request->getAttribute('entity');
18
19
        return new RedirectResponse($app->getRouteUrl('list', [
20
            'entity' => $entity,
21
        ]));
22
    }
23
24
    public function error($request, $response, $app)
0 ignored issues
show
Unused Code introduced by
The parameter $response 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...
25
    {
26
        $error = ErrorHandler::getException($request);
27
28
        return $app['templates']->render('pages/error', ['error' => $error]);
29
    }
30
}
31