GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — feature/cron_notation_support ( 04bcb2...ddb1da )
by Aleh
01:55
created

CronRule::getRrule()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Scheduler\Job;
4
5
use DateTimeInterface;
6
use Cron\CronExpression;
7
8
/**
9
 * Class CronRule
10
 * @package Scheduler\Job
11
 * @author Aleh Hutnikau, <[email protected]>
12
 */
13
class CronRule extends AbstractRule
14
{
15
16
    /**
17
     * @param DateTimeInterface $from
18
     * @param DateTimeInterface $to
19
     * @param boolean $inc
20
     * @throws
21
     * @return DateTimeInterface[]
22
     */
23 1
    public function getRecurrences(DateTimeInterface $from, DateTimeInterface $to, $inc = true)
24
    {
25 1
        $rRule = CronExpression::factory($this->getRrule());
26 1
        $result = [];
27
28 1
        if ($to->getTimestamp() < $this->getStartDate()->getTimestamp()) {
29 1
            return $result;
30
        }
31
32 1
        if ($from->getTimestamp() < $this->getStartDate()->getTimestamp()) {
33 1
            $from = clone $this->getStartDate();
34
        }
35
36 1
        $firstIteration = true;
37
38
        do {
39 1
            $nextRunDate = $rRule->getNextRunDate($from, 0, $firstIteration && $inc);
40 1
            if ($nextRunDate->getTimestamp() < ($to->getTimestamp() + (int) $inc) && $from->getTimestamp() <= $nextRunDate->getTimestamp()) {
41 1
                $result[] = $nextRunDate;
42
            }
43 1
            $firstIteration = false;
44 1
            $from = $nextRunDate;
45 1
        } while ($nextRunDate->getTimestamp() < ($to->getTimestamp() + (int) $inc));
46
47 1
        return $result;
48
    }
49
}