Conditions | 5 |
Paths | 8 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
33 | 2 | public function run(SchedulerInterface $scheduler, DateTimeInterface $from, DateTimeInterface $to = null, $inc = true) |
|
34 | { |
||
35 | 2 | $actionsIterator = $scheduler->getIterator($from, $to, $inc); |
|
36 | 2 | $reports = []; |
|
37 | 2 | foreach ($actionsIterator as $action) { |
|
38 | try { |
||
39 | 2 | if ($this->actionLog === null) { |
|
40 | 2 | $reports[] = new Report($action, $action()); |
|
41 | 2 | } else if ($this->actionLog->update($action)) { |
|
42 | 1 | $reports[] = new Report($action, $action()); |
|
43 | 1 | $this->actionLog->update($action); |
|
44 | 1 | } else { |
|
45 | //action already executed or taken by another worker |
||
46 | } |
||
47 | 2 | } catch (\Exception $e) { |
|
48 | 1 | $reports[] = new Report($action, $e, Report::TYPE_ERROR); |
|
49 | } |
||
50 | 2 | } |
|
51 | 2 | return $reports; |
|
52 | } |
||
53 | } |