Passed
Branch 2.0 (f5ddb0)
by Samuel
04:04
created

JsonHandler::setDefaultResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
namespace SMartins\Exceptions;
4
5
use Exception;
6
use SMartins\Exceptions\Handlers\Handler;
7
8
trait JsonHandler
9
{
10
    /**
11
     * Handle the json response. Check if exception is treated. If true call
12
     * the specific handler. If false set the default response to be returned.
13
     *
14
     * @param  Exception $exception
15
     * @return JsonResponse
0 ignored issues
show
Bug introduced by
The type SMartins\Exceptions\JsonResponse was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
     */
17
    public function jsonResponse(Exception $exception)
18
    {
19
        return (new Handler($exception))->handleException()->json();
0 ignored issues
show
Bug Best Practice introduced by
The expression return new SMartins\Exce...ndleException()->json() returns the type string which is incompatible with the documented return type SMartins\Exceptions\JsonResponse.
Loading history...
20
    }
21
}
22