Completed
Push — master ( 3cd0fc...2b313e )
by Damien
02:53
created

ExceptionController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handleExceptionAction() 0 10 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\Controller\Controller;
12
13
use Veto\Http\Request;
14
use Veto\Http\Response;
15
use Veto\Controller\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