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
Pull Request — master (#88)
by Lucien
06:51 queued 51s
created

DirectLinkQueryRequest::getValidOgoneUris()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
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