Total Complexity | 2 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
9 | class RespondWithJsonErrorJob extends Job |
||
10 | { |
||
11 | protected $content; |
||
12 | protected $status; |
||
13 | protected $headers; |
||
14 | protected $options; |
||
15 | |||
16 | 4 | public function __construct( |
|
17 | string $message = 'An error occurred', |
||
18 | int $code = 400, |
||
19 | int $status = 400, |
||
20 | array $headers = [], |
||
21 | int $options = 0 |
||
22 | ) { |
||
23 | 4 | $this->content = [ |
|
24 | 4 | 'status' => $status, |
|
25 | 'error' => [ |
||
26 | 4 | 'code' => $code, |
|
27 | 4 | 'message' => $message, |
|
28 | ], |
||
29 | ]; |
||
30 | |||
31 | 4 | $this->status = $status; |
|
32 | 4 | $this->headers = $headers; |
|
33 | 4 | $this->options = $options; |
|
34 | 4 | } |
|
35 | |||
36 | 4 | public function handle(ResponseFactory $response) : JsonResponse |
|
39 | } |
||
40 | } |
||
41 |