Passed
Push — develop ( 3af5b3...4680c2 )
by Remco
03:33
created

ConfigFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 17
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A get_config() 0 10 1
1
<?php
2
/**
3
 * Config factory
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2019 Pronamic
7
 * @license   GPL-3.0-or-later
8
 * @package   Pronamic\WordPress\Pay\Gateways\Adyen
9
 */
10
11
namespace Pronamic\WordPress\Pay\Gateways\Adyen;
12
13
use Pronamic\WordPress\Pay\Core\GatewayConfigFactory;
14
15
/**
16
 * Config factory
17
 *
18
 * @author  Remco Tolsma
19
 * @version 1.0.0
20
 * @since   1.0.0
21
 */
22
class ConfigFactory extends GatewayConfigFactory {
23
	/**
24
	 * Get configuration by post ID.
25
	 *
26
	 * @param int $post_id Post ID.
27
	 * @return Config
28
	 */
29 1
	public function get_config( $post_id ) {
30 1
		$config = new Config();
31
32 1
		$config->post_id             = intval( $post_id );
33 1
		$config->mode                = $this->get_meta( $post_id, 'mode' );
34 1
		$config->api_key             = $this->get_meta( $post_id, 'adyen_api_key' );
35 1
		$config->api_live_url_prefix = $this->get_meta( $post_id, 'adyen_api_live_url_prefix' );
36 1
		$config->merchant_account    = $this->get_meta( $post_id, 'adyen_merchant_account' );
37
38 1
		return $config;
39
	}
40
}
41