Passed
Push — master ( bd13ba...272332 )
by Sander
04:42 queued 02:26
created

CleanupJob   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 37
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 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, InteractsWithQueue, Queueable, 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, $relations
Loading history...
15
16
    /**
17
     * @var \Illuminate\Database\Eloquent\Collection
18
     */
19
    public $users;
20
21
    /**
22
     * @var
23
     */
24
    public $strategy;
25
26
    /**
27
     * Create a new job instance.
28
     *
29
     * @param  \Illuminate\Database\Eloquent\Collection  $users
30
     * @param  \Soved\Laravel\Gdpr\Jobs\Cleanup\CleanupStrategy  $strategy
31
     * @return void
32
     */
33
    public function __construct(
34
        Collection $users,
35
        CleanupStrategy $strategy
36
    ) {
37
        $this->users = $users;
38
        $this->strategy = $strategy;
39
    }
40
41
    /**
42
     * Execute the job.
43
     *
44
     * @return void
45
     */
46
    public function handle()
47
    {
48
        $this->strategy->execute($this->users);
49
    }
50
}
51