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

DirectLinkQueryRequest   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 78.26%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 53
ccs 18
cts 23
cp 0.7826
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setPayIdSub() 0 4 1
A getRequiredFields() 0 8 1
A getValidOgoneUris() 0 4 1
A validate() 0 21 5
1
<?php
2
/*
3
 * @author Nicolas Clavaud <[email protected]>
4
 */
5
6
namespace Ogone\DirectLink;
7
8
use Ogone\AbstractDirectLinkRequest;
9
use Ogone\ShaComposer\ShaComposer;
10
11
class DirectLinkQueryRequest extends AbstractDirectLinkRequest
12
{
13
14
    const TEST = "https://secure.ogone.com/ncol/test/querydirect.asp";
15
    const PRODUCTION = "https://secure.ogone.com/ncol/prod/querydirect.asp";
16
17 6
    public function __construct(ShaComposer $shaComposer)
18
    {
19 6
        $this->shaComposer = $shaComposer;
20 6
        $this->ogoneUri = self::TEST;
21 6
    }
22
23
    public function setPayIdSub($payidsub)
24
    {
25
        $this->parameters['payidsub'] = $payidsub;
26
    }
27
28 3
    public function getRequiredFields()
29
    {
30
        return array(
31 3
            'pspid',
32
            'userid',
33
            'pswd',
34
        );
35
    }
36
37 2
    public function getValidOgoneUris()
38
    {
39 2
        return array(self::TEST, self::PRODUCTION);
40
    }
41
42 3
    public function validate()
43
    {
44 3
        parent::validate();
45
46 2
        foreach ($this->getRequiredFieldGroups() as $group) {
47 2
            $empty = true;
48
49 2
            foreach ($group as $field) {
50 2
                if (!empty($this->parameters[$field])) {
51 2
                    $empty = false;
52 2
                    break;
53
                }
54
            }
55
56 2
            if ($empty) {
57
                throw new \RuntimeException(
58
                    sprintf("At least one of these fields should not be empty: %s", implode(', ', $group))
59
                );
60
            }
61
        }
62 2
    }
63
}
64