RespondWithViewJob::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 4
crap 1
1
<?php
2
3
namespace Anfischer\Foundation\Domains\Http\Jobs;
4
5
use Anfischer\Foundation\Job\Job;
6
use Illuminate\Contracts\Routing\ResponseFactory;
7
use Illuminate\Http\Response;
8
9
class RespondWithViewJob extends Job
10
{
11
    protected $status;
12
    protected $data;
13
    protected $headers;
14
    protected $template;
15
16 4
    public function __construct(string $template, array $data = [], int $status = 200, array $headers = [])
17
    {
18 4
        $this->template = $template;
19 4
        $this->data = $data;
20 4
        $this->status = $status;
21 4
        $this->headers = $headers;
22 4
    }
23
24 4
    public function handle(ResponseFactory $factory) : Response
25
    {
26 4
        return $factory->view($this->template, $this->data, $this->status, $this->headers);
27
    }
28
}
29