Code Duplication    Length = 44-45 lines in 2 locations

includes/class-map-model.php 1 location

@@ 13-56 (lines=44) @@
10
 *
11
 * @mixin WPMap
12
 */
13
class Map_Model extends Model_Base {
14
15
	/**
16
	 * @var WPMap
17
	 */
18
	protected $_map;
19
20
	/**
21
	 * @return bool
22
	 */
23
	function has_map() {
24
25
		return $this->_has('_map' );
26
27
	}
28
29
	/**
30
	 * @param  string $method_name
31
	 * @param  array  $args
32
	 *
33
	 * @return mixed
34
	 */
35
	function __call( $method_name, $args = array() ) {
36
		$value = null;
37
38
		do {
39
40
			if ( property_exists( $this, "_{$method_name}" ) ) {
41
				$property = "_{$method_name}";
42
				$value = $this->{$property};
43
				break;
44
			}
45
46
			if ( ! isset( $this->_map ) ) {
47
				break;
48
			}
49
50
			$value = call_user_func_array( array( $this->_map, $method_name ), $args );
51
52
		} while ( false );
53
54
		return $value;
55
	}
56
}
57

includes/class-marker-label-model.php 1 location

@@ 12-56 (lines=45) @@
9
 *
10
 * @mixin Marker_Label;
11
 */
12
class Marker_Label_Model extends Model_Base {
13
14
	/**
15
	 * @var \Clubdeuce\WPGoogleMaps\Marker_Label
16
	 */
17
	protected $_label;
18
19
	/**
20
	 * @return bool
21
	 */
22
	function has_label() {
23
24
		return $this->_has( '_label' );
25
26
	}
27
28
	/**
29
	 * @param  string $method_name
30
	 * @param  array  $args
31
	 *
32
	 * @return mixed
33
	 */
34
	function __call( $method_name, $args = array() ) {
35
		$value = null;
36
37
		do {
38
39
			if ( property_exists( $this, "_{$method_name}" ) ) {
40
				$property = "_{$method_name}";
41
				$value = $this->{$property};
42
				break;
43
			}
44
45
			if ( ! isset( $this->_label ) ) {
46
				break;
47
			}
48
49
			$value = call_user_func_array( array( $this->_label, $method_name ), $args );
50
51
		} while ( false );
52
53
		return $value;
54
	}
55
56
}
57