Lines 0.00% 0 / 8
Methods 0.00% 0 / 3
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 __construct 0.00% 0 / 3 0.00% 0 / 1 6
 log 0.00% 0 / 2 0.00% 0 / 1 6
 startProcessing 0.00% 0 / 3 0.00% 0 / 1 6
13class EventLogCleanUpByCron
14{
15    protected $verbose = false;
16
17    public function __construct(bool $verbose = false)
18    {
19        if ($verbose) {
20            $this->verbose = true;
21            $this->log("INFO: Delete old eventlog entries");
22        }
23    }
24
25    protected function log(string $message): void
26    {
27        if ($this->verbose) {
28            \App::$log->info($message);
29        }
30    }
31
32    public static function startProcessing(bool $commit = false): void
33    {
34        $eventLogRepo  = new EventLogRepository();
35        if ($commit) {
36            $eventLogRepo->deleteOutdated();
37        }
38    }
39}