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.
Passed
Push — master ( 07b164...660df5 )
by Kristjan
36s
created

Increasing::next()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace COG\ChronoShifter\Direction;
4
5
use COG\ChronoShifter\Period\Period;
6
7
/**
8
 * @author Kristjan Siimson <[email protected]>
9
 * @package Direction\Domain
10
 */
11 View Code Duplication
class Increasing implements Direction
0 ignored issues
show
Duplication introduced by
This class 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...
12
{
13
    /**
14
     * @param Period $period
15
     */
16 34
    public function next(Period $period)
17
    {
18 34
        $period->next();
19 34
    }
20
21
    /**
22
     * @param string $first
23
     * @param string $second
24
     * @return int
25
     */
26 53
    public function compare($first, $second)
27
    {
28
        // Discard time info
29 53
        $first = substr($first, 0, 10);
30 53
        $second = substr($second, 0, 10);
31
32 53
        if ($first === $second) {
33 15
            $result = 0;
34 53
        } else if (new \DateTime($first) > new \DateTime($second)) {
35 22
            $result = 1;
36 22
        } else {
37 18
            $result = -1;
38
        }
39
40 53
        return $result;
41
    }
42
}
43