Failed Conditions
Push — develop ( 5b958e...93bfb6 )
by Remco
05:43 queued 01:38
created

Integration::get_settings_fields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 55
Code Lines 38

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 38
nc 1
nop 0
dl 0
loc 55
ccs 0
cts 45
cp 0
crap 2
rs 9.312
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\MultiSafepay\Connect;
4
5
use Pronamic\WordPress\Pay\Gateways\MultiSafepay\AbstractIntegration;
6
7
/**
8
 * Title: MultiSafepay Connect integration
9
 * Description:
10
 * Copyright: 2005-2019 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Remco Tolsma
14
 * @version 2.0.2
15
 * @since   1.2.6
16
 */
17
class Integration extends AbstractIntegration {
18
	/**
19
	 * Integration constructor.
20
	 */
21
	public function __construct() {
22
		$this->id            = 'multisafepay-connect';
23
		$this->name          = 'MultiSafepay - Connect';
24
		$this->url           = 'http://www.multisafepay.com/';
25
		$this->product_url   = __( 'http://www.multisafepay.com/', 'pronamic_ideal' );
26
		$this->dashboard_url = 'https://merchant.multisafepay.com/';
27
		$this->provider      = 'multisafepay';
28
	}
29
30
	/**
31
	 * Get config factory class.
32
	 *
33
	 * @return string
34
	 */
35
	public function get_config_factory_class() {
36
		return __NAMESPACE__ . '\ConfigFactory';
37
	}
38
39
	public function get_settings_fields() {
40
		$fields = array();
41
42
		// Account ID
43
		$fields[] = array(
44
			'section'  => 'general',
45
			'filter'   => FILTER_SANITIZE_STRING,
46
			'meta_key' => '_pronamic_gateway_multisafepay_account_id',
47
			'title'    => __( 'Account ID', 'pronamic_ideal' ),
48
			'type'     => 'text',
49
			'classes'  => array( 'code' ),
50
			'methods'  => array( 'multisafepay_connect' ),
51
			'tooltip'  => sprintf(
52
				'%s %s.',
53
				__( 'Account ID', 'pronamic_ideal' ),
54
				/* translators: %s: MultiSafepay */
55
				sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) )
56
			),
57
		);
58
59
		// Site ID
60
		$fields[] = array(
61
			'section'  => 'general',
62
			'filter'   => FILTER_SANITIZE_STRING,
63
			'meta_key' => '_pronamic_gateway_multisafepay_site_id',
64
			'title'    => __( 'Site ID', 'pronamic_ideal' ),
65
			'type'     => 'text',
66
			'classes'  => array( 'code' ),
67
			'methods'  => array( 'multisafepay_connect' ),
68
			'tooltip'  => sprintf(
69
				'%s %s.',
70
				__( 'Site ID', 'pronamic_ideal' ),
71
				/* translators: %s: MultiSafepay */
72
				sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) )
73
			),
74
		);
75
76
		// Site Security Code
77
		$fields[] = array(
78
			'section'  => 'general',
79
			'filter'   => FILTER_SANITIZE_STRING,
80
			'meta_key' => '_pronamic_gateway_multisafepay_site_code',
81
			'title'    => __( 'Site Security Code', 'pronamic_ideal' ),
82
			'type'     => 'text',
83
			'classes'  => array( 'code' ),
84
			'methods'  => array( 'multisafepay_connect' ),
85
			'tooltip'  => sprintf(
86
				'%s %s.',
87
				__( 'Site Security Code', 'pronamic_ideal' ),
88
				/* translators: %s: MultiSafepay */
89
				sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) )
90
			),
91
		);
92
93
		return $fields;
94
	}
95
}
96