Signature   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 17
c 1
b 0
f 0
dl 0
loc 40
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A generate() 0 14 1
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\MultiSafepay;
4
5
use Pronamic\WordPress\Pay\Core\Util;
6
7
/**
8
 * Title: MultiSafepay Connect signature
9
 * Description:
10
 * Copyright: 2005-2021 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Remco Tolsma
14
 * @version 2.0.2
15
 * @since   1.0.0
16
 */
17
class Signature {
18
	public $account;
19
20
	public $site_id;
21
22
	public $site_secure_code;
23
24
	public $notification_url;
25
26
	public $redirect_url;
27
28
	public $cancel_url;
29
30
	public $close_window;
31
32
	/**
33
	 * Constructs and initialize an MultiSafepay Connect merchant object
34
	 *
35
	 * @param $amount         string
36
	 * @param $currency       string
37
	 * @param $account        string
38
	 * @param $site_id        string
39
	 * @param $transaction_id string
40
	 *
41
	 * @return string
42
	 */
43 2
	public static function generate( $amount, $currency, $account, $site_id, $transaction_id ) {
44
		$values = array(
45 2
			$amount,
46 2
			$currency,
47 2
			$account,
48 2
			$site_id,
49 2
			$transaction_id,
50
		);
51
52 2
		$string = implode( '', $values );
53
54 2
		$signature = md5( $string );
55
56 2
		return $signature;
57
	}
58
}
59