Completed
Push — master ( 45c651...8bfbde )
by Damien
02:27
created

ExceptionController::handleExceptionAction()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
/**
3
 * Veto.
4
 * PHP Microframework.
5
 *
6
 * @author Damien Walsh <[email protected]>
7
 * @copyright Damien Walsh 2013-2014
8
 * @version 0.3
9
 * @package veto
10
 */
11
namespace Veto\MVC\Controller;
12
13
use Veto\HTTP\Request;
14
use Veto\HTTP\Response;
15
use Veto\MVC\AbstractController;
16
17
/**
18
 * ExceptionController
19
 *
20
 * This is the default exception controller that will be called for any exceptions
21
 * from user code that make it to the kernel.
22
 *
23
 * You can override this by specifying a different class to be used for the
24
 * controller._exception_handler service.
25
 *
26
 * @since 0.3.0
27
 */
28
class ExceptionController extends AbstractController
29
{
30
    public function handleExceptionAction(Request $request, \Exception $exception)
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...
31
    {
32
        $response = 'Sorry, something went wrong.';
33
34
        if (404 === $exception->getCode()) {
35
            $response = 'The requested resource could not be found.';
36
        }
37
38
        return new Response($response, $exception->getCode());
39
    }
40
}
41