Completed
Push — master ( a9822c...8aa0e0 )
by Derek Stephen
14:27
created

ErrorController   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 23
c 0
b 0
f 0
ccs 10
cts 10
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A errorAction() 0 11 1
A notFoundAction() 0 1 1
A notAuthorisedAction() 0 1 1
1
<?php
2
3
namespace App\Controller;
4
5
use Bone\Mvc\Controller;
6
use Exception;
7
use Psr\Http\Message\ServerRequestInterface;
8
9
class ErrorController extends BaseController
10
{
11 3
    public function __construct(ServerRequestInterface $request)
12
    {
13 3
        parent::__construct($request);
14 3
    }
15
16 1
    public function errorAction()
17
    {
18
        /** @var Exception $e */
19 1
        $e = $this->getParam('error');
20
        $responseArray = [
21 1
            'code' => $e->getCode(),
22 1
            'message' => $e->getMessage(),
23 1
            'trace' => $e->getTrace(),
24
        ];
25 1
        $this->sendJsonResponse($responseArray, $e->getCode());
0 ignored issues
show
Unused Code introduced by
The call to ErrorController::sendJsonResponse() has too many arguments starting with $e->getCode().

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
26 1
    }
27
28
    public function notFoundAction(){}
29
30
    public function notAuthorisedAction(){}
31
}