Completed
Pull Request — master (#22)
by Daryl
03:27
created

Model_Base::__call()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 2
eloc 6
nc 2
nop 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
	protected function _has( $property ) {
17
18
		$has = false;
19
20
		if ( isset( $this->{$property} ) ) {
21
			$has = true;
22
		}
23
24
		return $has;
25
26
	}
27
28
	/**
29
	 * @param string $method_name
30
	 * @param array $args
31
	 *
32
	 * @return null
33
	 */
34
	function __call( $method_name, $args ) {
35
36
		$value = null;
37
38
		if ( property_exists( $this, "_{$method_name}" ) ) {
39
			$property = "_{$method_name}";
40
			$value = $this->{$property};
41
42
		}
43
44
		return $value;
45
46
	}
47
48
}
49