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 ( 205e15...45fc13 )
by Aleh
11s
created

RRule::getNextRecurrence()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 10

Duplication

Lines 14
Ratio 100 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 14
loc 14
ccs 10
cts 10
cp 1
rs 9.4285
cc 2
eloc 10
nc 2
nop 2
crap 2
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
use Recurr\Transformer\Constraint\AfterConstraint;
10
use Recurr\Transformer\Constraint\BetweenConstraint;
11
12
/**
13
 * Class RRule
14
 * @package Scheduler\Job
15
 * @author Aleh Hutnikau, <[email protected]>
16
 */
17
class RRule extends AbstractRule
18
{
19
20
    /**
21
     * @param DateTimeInterface $from
22
     * @param DateTimeInterface $to
23
     * @param boolean $inc
24
     * @throws
25
     * @return DateTimeInterface[]
26
     */
27 13 View Code Duplication
    public function getRecurrences(DateTimeInterface $from, DateTimeInterface $to, $inc = true)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
28
    {
29 13
        $rRule = new RecurrRule($this->getRrule(), $this->getStartDate());
30 13
        $rRuleTransformer = new ArrayTransformer();
31 13
        $constraint = new BetweenConstraint($from, $to, $inc);
32 13
        $recurrenceCollection = $rRuleTransformer->transform($rRule, $constraint);
33 13
        $result = [];
34
        /** @var Recurrence $recurrence */
35 13
        foreach ($recurrenceCollection as $recurrence) {
36 12
            $result[] = $recurrence->getStart();
37
        }
38 13
        return $result;
39
    }
40
41
    /**
42
     * @param DateTimeInterface $from
43
     * @param boolean $inc including $from and $to dates
44
     * @return DateTimeInterface|null date of the next recurrence or null of no more recurrences scheduled.
45
     * @throws
46
     */
47 1 View Code Duplication
    public function getNextRecurrence(DateTimeInterface $from, $inc = true)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
    {
49 1
        $rRule = new RecurrRule($this->getRrule(), $this->getStartDate());
50 1
        $rRuleTransformer = new ArrayTransformer();
51 1
        $constraint = new AfterConstraint($from, $inc);
52 1
        $recurrenceCollection = $rRuleTransformer->transform($rRule, $constraint);
53 1
        $result = null;
54
        /** @var Recurrence $recurrence */
55 1
        foreach ($recurrenceCollection as $recurrence) {
56 1
            $result = $recurrence->getStart();
57 1
            break;
58
        }
59 1
        return $result;
60
    }
61
}