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 ( fdd854...28ce8a )
by Dieter
03:06
created

DirectLinkPaymentRequest   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 68.57%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 12
lcom 1
cbo 2
dl 0
loc 71
ccs 24
cts 35
cp 0.6857
rs 10
c 2
b 0
f 1

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getValidOgoneUris() 0 4 1
A setPassword() 0 4 1
A setPswd() 0 7 2
A setAlias() 0 4 1
A setCvc() 0 4 1
A setEci() 0 4 1
A setUserId() 0 7 2
A getRequiredFields() 0 6 1
A getValidOperations() 0 9 1
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\AbstractPaymentRequest;
14
use Ogone\ShaComposer\ShaComposer;
15
use InvalidArgumentException;
16
17
class DirectLinkPaymentRequest extends AbstractPaymentRequest
18
{
19
20
    const TEST = "https://secure.ogone.com/ncol/test/orderdirect.asp";
21
    const PRODUCTION = "https://secure.ogone.com/ncol/prod/orderdirect.asp";
22
23 8
    public function __construct(ShaComposer $shaComposer)
24
    {
25 8
        $this->shaComposer = $shaComposer;
26 8
        $this->ogoneUri = self::TEST;
27 8
    }
28
29 5
    public function getRequiredFields()
30
    {
31
        return array(
32 5
            'pspid', 'currency', 'amount', 'orderid', 'userid', 'pswd'
33
        );
34
    }
35
36 2
    public function getValidOgoneUris()
37
    {
38 2
        return array(self::TEST, self::PRODUCTION);
39
    }
40
41 6
    public function setUserId($userid)
42
    {
43 6
        if (strlen($userid) < 2) {
44 1
            throw new InvalidArgumentException("User ID is too short");
45
        }
46 5
        $this->parameters['userid'] = $userid;
47 5
    }
48
49
    /** Alias for setPswd() */
50 5
    public function setPassword($password)
51
    {
52 5
        $this->setPswd($password);
53 5
    }
54
55 6
    public function setPswd($password)
56
    {
57 6
        if (strlen($password) < 8) {
58 1
            throw new InvalidArgumentException("Password is too short");
59
        }
60 5
        $this->parameters['pswd'] = $password;
61 5
    }
62
63 1
    public function setAlias(Alias $alias)
64
    {
65 1
        $this->parameters['alias'] = $alias->__toString();
66 1
    }
67
68
    public function setEci(Eci $eci)
69
    {
70
        $this->parameters['eci'] = (string) $eci;
71
    }
72
73
    public function setCvc($cvc)
74
    {
75
        $this->parameters['cvc'] = $cvc;
76
    }
77
78
    protected function getValidOperations()
79
    {
80
        return array(
81
            PaymentOperation::REQUEST_FOR_AUTHORISATION,
82
            PaymentOperation::REQUEST_FOR_DIRECT_SALE,
83
            PaymentOperation::REFUND,
84
            PaymentOperation::REQUEST_FOR_PRE_AUTHORISATION,
85
        );
86
    }
87
}
88