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

CleanDevTrackingAction::execute()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 4
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 7
rs 10
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