Completed
Push — master ( 1a7397...8cd977 )
by Daryl
04:36
created

Model_Base   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 47
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 3
A __call() 0 12 2
1
<?php
2
3
namespace Clubdeuce\WPGoogleMaps;
4
5
/**
6
 * Class Model_Base
7
 * @package Clubdeuce\WPGoogleMaps
8
 */
9
class Model_Base {
10
11
	/**
12
	 * @var array
13
	 */
14
	protected $_extra_args;
15
16
	/**
17
	 * Model_Base constructor.
18
	 *
19
	 * @param array $args
20
	 */
21 9
	public function __construct( $args = array() ) {
22
23 9
		$args = wp_parse_args( $args );
24
25 9
		foreach ( $args as $key => $arg ) {
26
27 8
			if ( property_exists( $this, "_{$key}" ) ) {
28 8
				$property = "_{$key}";
29 8
				$this->{$property} = $arg;
30
			}
31
32
		}
33
34 9
	}
35
36
	/**
37
	 * @param string $method_name
38
	 * @param array  $args
39
	 *
40
	 * @return mixed|null
41
	 */
42 6
	public function __call( $method_name, $args ) {
43
44 6
		$value = null;
45
46 6
		if ( property_exists( $this, "_{$method_name}" ) ) {
47 6
			$property = "_{$method_name}";
48 6
			$value    = $this->{$property};
49
		}
50
51 6
		return $value;
52
53
	}
54
55
}
56