Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
EventLogCleanUpByCron
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 3
42
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
 log
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
 startProcessing
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3/**
4 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
5 **/
6
7declare(strict_types=1);
8
9namespace BO\Zmsdb\Helper;
10
11use BO\Zmsdb\EventLog as EventLogRepository;
12
13class EventLogCleanUpByCron
14{
15    protected $verbose = false;
16
17    public function __construct($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($message)
26    {
27        if ($this->verbose) {
28            error_log($message);
29        }
30    }
31
32    public static function startProcessing($commit = false)
33    {
34        $eventLogRepo  = new EventLogRepository();
35        if ($commit) {
36            $eventLogRepo->deleteOutdated();
37        }
38    }
39}