Completed
Push — address-as-title ( 9b6eeb...601934 )
by Peter
11:07
created

MapsBaseFillableElement   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 11
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 38
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getJSONObject() 0 8 3
A getFillColor() 0 3 1
A setFillColor() 0 3 1
A getFillOpacity() 0 3 1
A setFillOpacity() 0 3 1
A hasFillColor() 0 3 2
A hasFillOpacity() 0 3 2
1
<?php
2
3
/**
4
 * @since 2.0
5
 */
6
class MapsBaseFillableElement extends MapsBaseStrokableElement implements iFillableMapElement {
7
8
	protected $fillColor;
9
	protected $fillOpacity;
10
11
	public function getFillColor() {
12
		return $this->fillColor;
13
	}
14
15
	public function setFillColor( $fillColor ) {
16
		$this->fillColor = trim($fillColor);
17
	}
18
19
	public function getFillOpacity() {
20
		return $this->fillOpacity;
21
	}
22
23
	public function setFillOpacity( $fillOpacity ) {
24
		$this->fillOpacity = trim($fillOpacity);
25
	}
26
27
	public function hasFillColor() {
28
		return !is_null( $this->fillColor ) && $this->fillColor !== '';
29
	}
30
31
	public function hasFillOpacity() {
32
		return !is_null( $this->fillOpacity ) && $this->fillOpacity !== '';
33
	}
34
35
	public function getJSONObject( $defText = '' , $defTitle = '' ) {
36
		$parentArray = parent::getJSONObject( $defText , $defTitle );
37
		$array = [
38
			'fillColor' => $this->hasFillColor() ? $this->getFillColor() : '#FF0000' ,
39
			'fillOpacity' => $this->hasFillOpacity() ? $this->getFillOpacity() : '0.5' ,
40
		];
41
		return array_merge( $parentArray , $array );
42
	}
43
}
44