Passed
Push — develop ( 511324...a79f51 )
by Remco
02:29
created

ConfigFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 7
dl 0
loc 16
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get_config() 0 9 1
1
<?php
2
/**
3
 * Config factory
4
 *
5
 * @author    Pronamic <[email protected]>
6
 * @copyright 2005-2018 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 2.0.0
20
 * @since   2.0.0
21
 */
22
class ConfigFactory extends GatewayConfigFactory {
23
	/**
24
	 * Get configuration by post ID.
25
	 *
26
	 * @param string $post_id Post ID.
27
	 * @return Config
28
	 */
29
	public function get_config( $post_id ) {
30
		$config = new Config();
31
32
		$config->post_id          = intval( $post_id );
33
		$config->mode             = $this->get_meta( $post_id, 'mode' );
34
		$config->api_key          = $this->get_meta( $post_id, 'adyen_api_key' );
35
		$config->merchant_account = $this->get_meta( $post_id, 'adyen_merchant_account' );
36
37
		return $config;
38
	}
39
}
40