Completed
Push — master ( 898e77...f00d09 )
by Daryl
04:31
created

Marker_Label_Model   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 103
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 103
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A color() 0 5 1
A font_family() 0 5 1
A font_size() 0 5 1
A font_weight() 0 5 1
A text() 0 5 1
A json_object() 0 5 1
A options() 0 17 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
class Marker_Label_Model extends \WPLib_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 = null;
35
36
    /**
37
     * @return string
38
     */
39
    function color() {
40
41
        return $this->_color;
42
43
    }
44
45
    /**
46
     * @return null|string
47
     */
48
    function font_family() {
49
50
        return $this->_font_family;
51
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    function font_size() {
58
59
        return $this->_font_size;
60
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    function font_weight() {
67
68
        return $this->_font_weight;
69
70
    }
71
72
    /**
73
     * @return null|string
74
     */
75
    function text() {
76
77
        return $this->_text;
78
79
    }
80
81
    /**
82
     * @return string
83
     */
84
    function json_object() {
85
86
        return json_encode( $this->options() );
87
88
    }
89
90
    /**
91
     * @return array
92
     */
93
    function options() {
94
95
        $args = [
96
            'color'      => $this->color(),
97
            'fontFamily' => $this->font_family(),
98
            'fontSize'   => $this->font_size(),
99
            'fontWeight' => $this->font_weight(),
100
            'text'       => $this->text(),
101
        ];
102
103
        $args = array_filter( $args, function( $value ) {
104
            return ! is_null( $value );
105
        } );
106
107
        return $args;
108
109
    }
110
111
}
112