IndexNowSubmitJob   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 33
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A uniqueId() 0 3 1
A handle() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LaravelFreelancerNL\LaravelIndexNow\Jobs;
6
7
use Illuminate\Bus\Queueable;
8
use Illuminate\Contracts\Queue\ShouldBeUnique;
9
use Illuminate\Contracts\Queue\ShouldQueue;
10
use Illuminate\Foundation\Bus\Dispatchable;
11
use Illuminate\Queue\InteractsWithQueue;
12
use Illuminate\Queue\SerializesModels;
13
use LaravelFreelancerNL\LaravelIndexNow\Facades\IndexNow;
14
15
class IndexNowSubmitJob implements ShouldBeUnique, ShouldQueue
16
{
17
    use Dispatchable;
18
    use InteractsWithQueue;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\InteractsWithQueue requires some properties which are not provided by LaravelFreelancerNL\Lara...\Jobs\IndexNowSubmitJob: $failedWith, $releaseDelay
Loading history...
19
    use Queueable;
20
    use SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by LaravelFreelancerNL\Lara...\Jobs\IndexNowSubmitJob: $collectionClass, $id, $relations, $class, $keyBy
Loading history...
21
22
    /**
23
     * @var string|string[]
24
     */
25
    protected array|string $urls;
26
27
    /**
28
     * @param  string|string[]  $urls
29
     */
30 3
    public function __construct(array|string $urls)
31
    {
32 3
        $this->urls = $urls;
33
    }
34
35 1
    public function handle(): void
36
    {
37 1
        IndexNow::submit($this->urls);
0 ignored issues
show
Bug Best Practice introduced by
The method LaravelFreelancerNL\Lara...ades\IndexNow::submit() is not static, but was called statically. ( Ignorable by Annotation )

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

37
        IndexNow::/** @scrutinizer ignore-call */ 
38
                  submit($this->urls);
Loading history...
38
    }
39
40
    /**
41
     * The unique ID of the job.
42
     *
43
     * @return string
44
     */
45 2
    public function uniqueId()
46
    {
47 2
        return md5((string) json_encode($this->urls));
48
    }
49
}
50