Code Duplication    Length = 44-45 lines in 2 locations

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

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

includes/class-map-model.php 1 location

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