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

ErrorController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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
}