Passed
Push — master ( cefb78...c2816e )
by Chris
10:44
created

StartModerationDetection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handle() 0 3 1
1
<?php
2
3
namespace Meema\MediaRecognition\Jobs;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Illuminate\Foundation\Bus\Dispatchable;
8
use Illuminate\Queue\InteractsWithQueue;
9
use Illuminate\Queue\SerializesModels;
10
use Meema\MediaRecognition\Facades\Recognize;
11
12
class StartModerationDetection implements ShouldQueue
13
{
14
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by Meema\MediaRecognition\J...tartModerationDetection: $id, $relations, $class, $keyBy
Loading history...
15
16
    private string $path;
17
18
    private ?int $mediaId;
19
20
    private ?int $minConfidence;
21
22
    /**
23
     * Create a new job instance.
24
     *
25
     * @param string $path
26
     * @param int|null $mediaId
27
     * @param int|null $minConfidence
28
     */
29
    public function __construct(string $path, $mediaId = null, $minConfidence = null)
30
    {
31
        $this->path = $path;
32
        $this->mediaId = $mediaId;
33
        $this->minConfidence = $minConfidence;
34
    }
35
36
    /**
37
     * Execute the job.
38
     *
39
     * @return void
40
     * @throws \Exception
41
     */
42
    public function handle()
43
    {
44
        Recognize::source($this->path)->detectModeration($this->mediaId, $this->minConfidence);
45
    }
46
}
47