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   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 1
dl 32
loc 32
ccs 13
cts 13
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A next() 4 4 1
A compare() 16 16 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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