CleanDevTrackingJob   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 8
c 4
b 0
f 0
dl 0
loc 24
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 3
A __construct() 0 4 1
1
<?php
2
3
namespace Sfneal\Tracking\Jobs;
4
5
use Sfneal\Queueables\Job;
6
use Sfneal\Tracking\Utils\ModelAdapter;
7
8
class CleanDevTrackingJob extends Job
9
{
10
    /**
11
     * CleanDevTrackingJob constructor.
12
     */
13
    public function __construct()
14
    {
15
        $this->onQueue(config('tracking.queue'));
16
        $this->onConnection(config('tracking.driver'));
17
    }
18
19
    /**
20
     * Execute the job.
21
     *
22
     * @return void
23
     */
24
    public function handle()
25
    {
26
        // Delete TrackTraffic data from 'development' envs that don't have associated activity data
27
        while (! isset($deleted) || $deleted > 0) {
28
            $deleted = ModelAdapter::TrackTraffic()::query()
29
                ->whereEnvironmentDevelopment()
30
                ->limit(100)
31
                ->delete();
32
        }
33
    }
34
}
35