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.

Increasing::compare()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 10

Duplication

Lines 16
Ratio 100 %

Code Coverage

Tests 10
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 16
loc 16
ccs 10
cts 10
cp 1
rs 9.4285
cc 3
eloc 10
nc 3
nop 2
crap 3
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