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 (#82)
by
unknown
03:34
created

FlexCheckoutPaymentResponse   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 61
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 4 1
A isSuccessful() 0 5 1
1
<?php namespace Ogone\FlexCheckout;
2
3
use Ogone\AbstractPaymentResponse;
4
use Ogone\ShaComposer\ShaComposer;
5
use InvalidArgumentException;
6
7
class FlexCheckoutPaymentResponse extends AbstractPaymentResponse
8
{
9
	/**
10
	 * @var int
11
	 */
12
	const STATUS_OK = 0;
13
	/**
14
	 * @var int
15
	 */
16
	const STATUS_NOK = 1;
17
	/**
18
	 * @var int
19
	 */
20
	const STATUS_ALIAS_UPDATED = 2;
21
	/**
22
	 * @var int
23
	 */
24
	const STATUS_ALIAS_CANCELLED = 3;
25
26
	const PARAM_ALIAS_ALIASID = "ALIAS_ALIASID";
27
	const PARAM_ALIAS_ORDERID = "ALIAS_ORDERID";
28
	const PARAM_ALIAS_STATUS = "ALIAS_STATUS";
29
	const PARAM_ALIAS_NCERROR = "ALIAS_NCERROR";
30
	const PARAM_ALIAS_NCERRORCARDNO = "ALIAS_NCERRORCARDNO";
31
	const PARAM_ALIAS_NCERRORCN = "ALIAS_NCERRORCN";
32
	const PARAM_ALIAS_NCERRORCVC = "ALIAS_NCERRORCVC";
33
	const PARAM_ALIAS_NCERRORED = "ALIAS_NCERRORED";
34
35
	protected $ogoneFields = array(
36
		'ALIAS_ALIASID',
37
		'CARD_BIN',
38
		'CARD_BRAND',
39
		'CARD_CARDNUMBER',
40
		'CARD_CARDHOLDERNAME',
41
		'CARD_CVC',
42
		'CARD_EXPIRYDATE',
43
		'ALIAS_NCERROR',
44
		'ALIAS_NCERRORCARDNO',
45
		'ALIAS_NCERRORCN',
46
		'ALIAS_NCERRORCVC',
47
		'ALIAS_NCERRORED',
48
		'ALIAS_ORDERID',
49
		'ALIAS_STATUS',
50
	);
51
52
	/**
53
	 * Checks if the response is valid
54
	 * @param ShaComposer $shaComposer
55
	 * @return bool
56
	 */
57
	public function isValid(ShaComposer $shaComposer)
58
	{
59
		return $shaComposer->compose($this->parameters) == $this->shaSign;
60
	}
61
62
	public function isSuccessful()
63
	{
64
		return in_array($this->getParam(static::PARAM_ALIAS_STATUS),
65
			array(static::STATUS_OK, static::STATUS_ALIAS_UPDATED,));
66
	}
67
}
68