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.

OnOrAfter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 0
dl 28
loc 28
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A accept() 7 7 1

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\Iterator\Filter;
4
5
/**
6
 * @author Kristjan Siimson <[email protected]>
7
 * @package Iterator\Filter\Domain
8
 */
9 View Code Duplication
class OnOrAfter extends \FilterIterator
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...
10
{
11
    /**
12
     * @var string
13
     */
14
    private $date;
15
16
    /**
17
     * @param \Iterator $iterator
18
     * @param string $date
19
     */
20 1
    public function __construct(\Iterator $iterator, $date)
21
    {
22 1
        parent::__construct($iterator);
23 1
        $this->date = substr($date, 0, 10);
24 1
    }
25
26
    /**
27
     * @return bool
28
     */
29 1
    public function accept()
30
    {
31 1
        $current = new \DateTime(parent::current());
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (current() instead of accept()). Are you sure this is correct? If so, you might want to change this to $this->current().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
32 1
        $current->setTime(0, 0, 0);
33
34 1
        return $current >= new \DateTime($this->date);
35
    }
36
}
37