Completed
Push — master ( 1a7397...8cd977 )
by Daryl
04:36
created

Marker_Label::font_weight()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Clubdeuce\WPGoogleMaps;
4
5
/**
6
 * Class Marker_Label
7
 * @package Clubdeuce\WPGoogleMaps
8
 */
9
class Marker_Label extends Model_Base {
10
11
	/**
12
	 * @var string
13
	 */
14
	protected $_color = 'black';
15
16
	/**
17
	 * @var null|string
18
	 */
19
	protected $_font_family = null;
20
21
	/**
22
	 * @var string
23
	 */
24
	protected $_font_size = '14px';
25
26
	/**
27
	 * @var string
28
	 */
29
	protected $_font_weight = '400';
30
31
	/**
32
	 * @var null|string
33
	 */
34
	protected $_text = '';
35
36
	/**
37
	 * @return string
38
	 */
39 2
	function color() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
40
41 2
		return (string)$this->_color;
42
43
	}
44
45
	/**
46
	 * @return null|string
47
	 */
48 2
	function font_family() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
49
50 2
		return (string)$this->_font_family;
51
52
	}
53
54
	/**
55
	 * @return string
56
	 */
57 2
	function font_size() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
58
59 2
		return (string)$this->_font_size;
60
61
	}
62
63
	/**
64
	 * @return string
65
	 */
66 2
	function font_weight() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
67
68 2
		return (string)$this->_font_weight;
69
70
	}
71
72
	/**
73
	 * @return null|string
74
	 */
75 2
	function text() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
76
77 2
		return (string)$this->_text;
78
79
	}
80
81
	/**
82
	 * @return string
83
	 *
84
	 * @todo Is this used? If not, remove it.
85
	 */
86 1
	function json_object() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
87
88 1
		return json_encode( $this->options() );
89
90
	}
91
92
	/**
93
	 * @return string|array
94
	 */
95 1
	function options() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
96
97
		$args = [
98 1
			'color'      => $this->color(),
99 1
			'fontFamily' => $this->font_family(),
100 1
			'fontSize'   => $this->font_size(),
101 1
			'fontWeight' => $this->font_weight(),
102 1
			'text'       => $this->text(),
103
		];
104
105 1
		$args = array_filter( $args, function( $value ) {
106 1
			return ! is_null( $value );
107 1
		} );
108
109
		if ( empty( $args['text'] ) ) {
110
			$args = '';
111
		}
112
113
		return $args;
114
115
	}
116
117
}
118