CleanupJob   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 3 1
A __construct() 0 6 1
1
<?php
2
3
namespace Soved\Laravel\Gdpr\Jobs\Cleanup;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Queue\SerializesModels;
7
use Illuminate\Queue\InteractsWithQueue;
8
use Illuminate\Contracts\Queue\ShouldQueue;
9
use Illuminate\Foundation\Bus\Dispatchable;
10
use Illuminate\Database\Eloquent\Collection;
11
12
class CleanupJob implements ShouldQueue
13
{
14
    use Dispatchable;
15
    use InteractsWithQueue;
16
    use Queueable;
17
    use SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by Soved\Laravel\Gdpr\Jobs\Cleanup\CleanupJob: $id, $class
Loading history...
18
19
    /**
20
     * @var \Illuminate\Database\Eloquent\Collection
21
     */
22
    public $users;
23
24
    /**
25
     * @var \Soved\Laravel\Gdpr\Jobs\Cleanup\CleanupStrategy
26
     */
27
    public $strategy;
28
29
    /**
30
     * Create a new job instance.
31
     *
32
     * @param \Soved\Laravel\Gdpr\Jobs\Cleanup\CleanupStrategy $strategy
33
     *
34
     * @return void
35
     */
36
    public function __construct(
37
        Collection $users,
38
        CleanupStrategy $strategy
39
    ) {
40
        $this->users = $users;
41
        $this->strategy = $strategy;
42
    }
43
44
    /**
45
     * Execute the job.
46
     *
47
     * @return void
48
     */
49
    public function handle()
50
    {
51
        $this->strategy->execute($this->users);
52
    }
53
}
54