CleanStatisticsRequests   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 4 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Statistics\Jobs;
6
7
use Carbon\Carbon;
8
use Illuminate\Bus\Queueable;
9
use Illuminate\Queue\SerializesModels;
10
use Illuminate\Queue\InteractsWithQueue;
11
use Illuminate\Contracts\Queue\ShouldQueue;
12
use Illuminate\Foundation\Bus\Dispatchable;
13
14
class CleanStatisticsRequests implements ShouldQueue
15
{
16
    use Dispatchable;
17
    use InteractsWithQueue;
18
    use Queueable;
19
    use SerializesModels;
20
21
    /**
22
     * Execute the job.
23
     *
24
     * @return void
25
     */
26
    public function handle(): void
27
    {
28
        ! config('rinvex.statistics.lifetime') || app('rinvex.statistics.request')->where('created_at', '<=', Carbon::now()->subDays(config('rinvex.statistics.lifetime')))->delete();
29
    }
30
}
31