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 ( 3bb2ca...deaed9 )
by Jelte
01:08
created

DirectLinkQueryRequest::validate()   B

Complexity

Conditions 5
Paths 7

Size

Total Lines 21
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 5.2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 21
ccs 12
cts 15
cp 0.8
rs 8.7624
cc 5
eloc 11
nc 7
nop 0
crap 5.2
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 3
            'userid',
33 3
            'pswd',
34 3
        );
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 2
            }
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 2
        }
62 2
    }
63
}
64