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

StartLabelDetection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 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 StartLabelDetection 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\Jobs\StartLabelDetection: $id, $relations, $class, $keyBy
Loading history...
15
16
    private string $path;
17
18
    private ?int $mediaId;
19
20
    private ?int $minConfidence;
21
22
    private int $maxResults;
23
24
    /**
25
     * Create a new job instance.
26
     *
27
     * @param string $path
28
     * @param int|null $mediaId
29
     * @param int|null $minConfidence
30
     * @param int $maxResults
31
     */
32
    public function __construct(string $path, $mediaId = null, $minConfidence = null, $maxResults = 1000)
33
    {
34
        $this->path = $path;
35
        $this->mediaId = $mediaId;
36
        $this->minConfidence = $minConfidence;
37
        $this->maxResults = $maxResults;
38
    }
39
40
    /**
41
     * Execute the job.
42
     *
43
     * @return void
44
     * @throws \Exception
45
     */
46
    public function handle()
47
    {
48
        Recognize::source($this->path)->detectLabels($this->mediaId, $this->minConfidence, $this->maxResults);
49
    }
50
}
51