Completed
Pull Request — master (#22)
by Daryl
01:39
created

Marker_Label_Model::options()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 21
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

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