Completed
Pull Request — master (#22)
by Daryl
02:28
created

Model_Base::__call()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Clubdeuce\WPLib\Components\GoogleMaps;
4
5
/**
6
 * Class Model_Base
7
 * @package Clubdeuce\WPLib\Components\GoogleMaps
8
 */
9
class Model_Base extends \WPLib_Model_Base {
10
11
	/**
12
	 * @param $property
13
	 *
14
	 * @return bool
15
	 */
16 1
	protected function _has( $property ) {
17
18 1
		$has = false;
19
20 1
		if ( isset( $this->{$property} ) ) {
21 1
			$has = true;
22
		}
23
24 1
		return $has;
25
26
	}
27
28
	/**
29
	 * @param string $method_name
30
	 * @param array $args
31
	 *
32
	 * @return null|mixed
33
	 */
34 1
	function __call( $method_name, $args ) {
35
36 1
		$value = null;
37
38 1
		if ( property_exists( $this, "_{$method_name}" ) ) {
39 1
			$property = "_{$method_name}";
40 1
			$value = $this->{$property};
41
42
		}
43
44 1
		return $value;
45
46
	}
47
48
}
49