Completed
Push — master ( 684184...9a35aa )
by Jeroen De
08:07
created

includes/Maps_BaseStrokableElement.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
use Maps\Elements\BaseElement;
4
5
/**
6
 * @since 2.0
7
 *
8
 * @licence GNU GPL v2+
9
 * @author Kim Eik < [email protected] >
10
 */
11
class MapsBaseStrokableElement extends BaseElement implements iStrokableMapElement {
12
13
	protected $strokeColor;
14
	protected $strokeOpacity;
15
	protected $strokeWeight;
16
17
	public function getStrokeColor() {
18
		return $this->strokeColor;
19
	}
20
21
	public function setStrokeColor( $strokeColor ) {
22
		$this->strokeColor = trim($strokeColor);
23
	}
24
25
	public function getStrokeOpacity() {
26
		return $this->strokeOpacity;
27
	}
28
29
	public function setStrokeOpacity( $strokeOpacity ) {
30
		$this->strokeOpacity = trim($strokeOpacity);
31
	}
32
33
	public function getStrokeWeight() {
34
		return $this->strokeWeight;
35
	}
36
37
	public function setStrokeWeight( $strokeWeight ) {
38
		$this->strokeWeight = trim($strokeWeight);
39
	}
40
41
	public function hasStrokeColor() {
42
		return !is_null( $this->strokeColor ) && $this->strokeColor !== '';
43
	}
44
45
	public function hasStrokeOpacity() {
46
		return !is_null( $this->strokeOpacity ) && $this->strokeOpacity !== '';
47
	}
48
49
	public function hasStrokeWeight() {
50
		return !is_null( $this->strokeWeight ) && $this->strokeWeight !== '';
51
	}
52
53
	public function getJSONObject( $defText = '' , $defTitle = '' ) {
54
		$parentArray = parent::getJSONObject( $defText , $defTitle );
0 ignored issues
show
Deprecated Code introduced by
The method Maps\Elements\BaseElement::getJSONObject() has been deprecated.

This method has been deprecated.

Loading history...
55
		$array = [
56
			'strokeColor' => $this->hasStrokeColor() ? $this->getStrokeColor() : '#FF0000' ,
57
			'strokeOpacity' => $this->hasStrokeOpacity() ? $this->getStrokeOpacity() : '1' ,
58
			'strokeWeight' => $this->hasStrokeWeight() ? $this->getStrokeWeight() : '2'
59
		];
60
		return array_merge( $parentArray , $array );
61
	}
62
63
}
64