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 — master ( c91cad...6ff168 )
by Aleh
31:27 queued 06:26
created

RRule::getRrule()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Scheduler\Job;
4
5
use DateTimeInterface;
6
use Recurr\Rule as RecurrRule;
7
use Recurr\Recurrence;
8
use Recurr\Transformer\ArrayTransformer;
9
10
/**
11
 * Interface RRule
12
 * @package Scheduler\Job
13
 */
14
class RRule implements RRuleInterface
15
{
16
17
    private $startDate;
18
    private $rRule;
19
20
    /**
21
     * RRule constructor.
22
     * @param string $rRule
23
     * @param string|DateTimeInterface $startDate
24
     */
25
    public function __construct($rRule, DateTimeInterface $startDate)
26
    {
27
        $this->rRule = $rRule;
28
        $this->startDate = $startDate;
29
    }
30
31
    /**
32
     * @return DateTimeInterface
33
     */
34
    public function getStartDate()
35
    {
36
        return $this->startDate;
37
    }
38
39
    /**
40
     * @return string RRULE string
41
     */
42
    public function getRrule()
43
    {
44
        return $this->rRule;
45
    }
46
47
    /**
48
     * @param DateTimeInterface $from
49
     * @param DateTimeInterface $to
50
     * @param boolean $inc
51
     * @throws
52
     * @return DateTimeInterface[]
53
     */
54
    public function getRecurrences(DateTimeInterface $from, DateTimeInterface $to, $inc = true)
55
    {
56
        $rRule = new RecurrRule($this->getRrule(), $this->getStartDate());
57
        $rRuleTransformer = new ArrayTransformer();
58
        $recurrenceCollection = $rRuleTransformer->transform($rRule)->startsBetween($from, $to, $inc);
59
        $result = [];
60
        /** @var Recurrence $recurrence */
61
        foreach ($recurrenceCollection as $recurrence) {
62
            $result[] =$recurrence->getStart();
63
        }
64
        return $result;
65
    }
66
}