Passed
Push — master ( 976aad...1511ac )
by Aleksandr
01:47
created

LoggingJob::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace San4io\RequestLogger\Jobs;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Illuminate\Foundation\Bus\Dispatchable;
0 ignored issues
show
Bug introduced by
The type Illuminate\Foundation\Bus\Dispatchable 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...
8
use Illuminate\Queue\InteractsWithQueue;
9
use Illuminate\Queue\SerializesModels;
10
use San4io\RequestLogger\Logger\RequestLogger;
11
use Symfony\Component\HttpFoundation\Request;
12
use Symfony\Component\HttpFoundation\Response;
13
14
class LoggingJob implements ShouldQueue
15
{
16
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
17
18
    /**
19
     * @var Request
20
     */
21
    public $request;
22
23
    /**
24
     * @var Response
25
     */
26
    public $response;
27
28
    /**
29
     * Create a new job instance.
30
     *
31
     * @param Request $request
32
     * @param Response $response
33
     */
34
    public function __construct(Request $request, Response $response)
35
    {
36
        $this->request = $request;
37
        $this->response = $response;
38
    }
39
40
    /**
41
     * Execute the job.
42
     *
43
     * @return void
44
     */
45
    public function handle()
46
    {
47
        /** @var RequestLogger $requestLogger */
48
        $requestLogger = app(RequestLogger::class);
0 ignored issues
show
Bug introduced by
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

48
        $requestLogger = /** @scrutinizer ignore-call */ app(RequestLogger::class);
Loading history...
49
        $requestLogger->log($this->request, $this->response);
50
    }
51
}
52