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 ( e97bb7...5f2eb5 )
by Pascal
10:40 queued 09:38
created

CheckerIsStillFailing   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 37
loc 37
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 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 ProtoneMedia\ApiHealth\Events;
4
5
use ProtoneMedia\ApiHealth\Checkers\Checker;
6
use ProtoneMedia\ApiHealth\Checkers\CheckerHasFailed;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, ProtoneMedia\ApiHealth\Events\CheckerHasFailed.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
7
8 View Code Duplication
class CheckerIsStillFailing extends CheckerHasFailed
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...
9
{
10
    /**
11
     * The checker.
12
     *
13
     * @var \ProtoneMedia\ApiHealth\Checkers\Checker
14
     */
15
    public $checker;
16
17
    /**
18
     * The exception.
19
     *
20
     * @var \ProtoneMedia\ApiHealth\Checkers\CheckerHasFailed
21
     */
22
    public $exception;
23
24
    /**
25
     * The failed data.
26
     *
27
     * @var array
28
     */
29
    public $failedData;
30
31
    /**
32
     * Creates a new instance of this event.
33
     *
34
     * @param \ProtoneMedia\ApiHealth\Checkers\Checker  $checker
35
     * @param \ProtoneMedia\ApiHealth\Checkers\CheckerHasFailed  $exception
36
     * @param array  $failedData
37
     */
38
    public function __construct(Checker $checker, CheckerHasFailed $exception, array $failedData)
39
    {
40
        $this->checker    = $checker;
41
        $this->exception  = $exception;
42
        $this->failedData = $failedData;
43
    }
44
}
45