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 ( 9050e5...dbe7d3 )
by
unknown
02:26
created

CreateAliasResponse   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 26.67 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 8
loc 30
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isSuccessful() 0 4 1
A getAlias() 0 4 1
A isValid() 8 8 2

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
 * This file is part of the Marlon Ogone package.
4
 *
5
 * (c) Marlon BVBA <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Ogone\DirectLink;
12
13
use Ogone\AbstractResponse;
14
use Ogone\ShaComposer\ShaComposer;
15
16
class CreateAliasResponse extends AbstractResponse
17
{
18
19
    const STATUS_OK = 0;
20
    const STATUS_NOK = 1;
21
    const STATUS_UPDATED = 2;
22
23
    /**
24
     * Checks if the response is valid
25
     * @return bool
26
     */
27 1 View Code Duplication
    public function isValid(ShaComposer $shaComposer)
0 ignored issues
show
Duplication introduced by
This method 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...
28
    {
29 1
        if (function_exists('hash_equals')) {
30 1
            return hash_equals($shaComposer->compose($this->parameters), $this->shaSign);
31
        } else {
32
            return $shaComposer->compose($this->parameters) == $this->shaSign;
33
        }
34
    }
35
36 1
    public function isSuccessful()
37
    {
38 1
        return in_array($this->getParam('STATUS'), array(self::STATUS_OK, self::STATUS_UPDATED));
39
    }
40
41 1
    public function getAlias()
42
    {
43 1
        return new Alias($this->parameters['ALIAS'], $this->parameters['CN'], $this->parameters['CARDNO'], $this->parameters['ED']);
44
    }
45
}
46