Passed
Push — master ( 6b0e6b...43789e )
by Stephen
03:30
created

CleanDevTrackingAction   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 7 3
1
<?php
2
3
namespace Sfneal\Tracking\Actions;
4
5
use Sfneal\Actions\AbstractActionStatic;
6
use Sfneal\Tracking\Models\TrackTraffic;
7
8
class CleanDevTrackingAction extends AbstractActionStatic
9
{
10
    /**
11
     * Execute the Action.
12
     *
13
     * @return void
14
     */
15
    public static function execute()
16
    {
17
        // Delete TrackTraffic data from 'development' envs that don't have associated activity data
18
        while (! isset($deleted) || $deleted > 0) {
19
            $deleted = TrackTraffic::query()
20
                ->where('app_environment', '=', 'development')
21
                ->limit(100)->delete();
22
        }
23
    }
24
}
25