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

Marker_Label_Model::has_label()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 5
loc 5
ccs 2
cts 2
cp 1
rs 9.4285
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Clubdeuce\WPLib\Components\GoogleMaps;
4
5
/**
6
 * Class Marker_Label_Model
7
 * @package Clubdeuce\WPLib\Components\GoogleMaps
8
 *
9
 * @mixin Marker_Label;
10
 */
11 View Code Duplication
class Marker_Label_Model extends Model_Base {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

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