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

StartTextDetection   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 handle() 0 3 1
A __construct() 0 5 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 StartTextDetection 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\StartTextDetection: $id, $relations, $class, $keyBy
Loading history...
15
16
    private string $path;
17
18
    private ?int $mediaId;
19
20
    private array $filters;
21
22
    /**
23
     * Create a new job instance.
24
     *
25
     * @param string $path
26
     * @param int|null $mediaId
27
     * @param array $filters
28
     */
29
    public function __construct(string $path, $mediaId = null, $filters = [])
30
    {
31
        $this->path = $path;
32
        $this->mediaId = $mediaId;
33
        $this->filters = $filters;
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)->detectText($this->mediaId, $this->filters);
0 ignored issues
show
Unused Code introduced by
The call to Meema\MediaRecognition\C...cognition::detectText() has too many arguments starting with $this->filters. ( Ignorable by Annotation )

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

44
        Recognize::source($this->path)->/** @scrutinizer ignore-call */ detectText($this->mediaId, $this->filters);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
45
    }
46
}
47