Completed
Push — cleanz ( 70f885...f1882e )
by Jeroen De
26:41 queued 16:46
created

BaseStrokableElement   A

Complexity

Total Complexity 16

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 16
lcom 1
cbo 1
dl 0
loc 53
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getJSONObject() 0 9 4
A hasStrokeColor() 0 3 2
A getStrokeColor() 0 3 1
A setStrokeColor() 0 3 1
A hasStrokeOpacity() 0 3 2
A getStrokeOpacity() 0 3 1
A setStrokeOpacity() 0 3 1
A hasStrokeWeight() 0 3 2
A getStrokeWeight() 0 3 1
A setStrokeWeight() 0 3 1
1
<?php
2
3
namespace Maps\Elements;
4
5
/**
6
 * @since 2.0
7
 *
8
 * @licence GNU GPL v2+
9
 * @author Kim Eik < [email protected] >
10
 */
11
class BaseStrokableElement extends BaseElement {
12
13
	protected $strokeColor;
14
	protected $strokeOpacity;
15
	protected $strokeWeight;
16
17
	public function getJSONObject( string $defText = '', string $defTitle = '' ): array {
18
		$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...
19
		$array = [
20
			'strokeColor' => $this->hasStrokeColor() ? $this->getStrokeColor() : '#FF0000',
21
			'strokeOpacity' => $this->hasStrokeOpacity() ? $this->getStrokeOpacity() : '1',
22
			'strokeWeight' => $this->hasStrokeWeight() ? $this->getStrokeWeight() : '2'
23
		];
24
		return array_merge( $parentArray, $array );
25
	}
26
27
	public function hasStrokeColor() {
28
		return !is_null( $this->strokeColor ) && $this->strokeColor !== '';
29
	}
30
31
	public function getStrokeColor() {
32
		return $this->strokeColor;
33
	}
34
35
	public function setStrokeColor( $strokeColor ) {
36
		$this->strokeColor = trim( $strokeColor );
37
	}
38
39
	public function hasStrokeOpacity() {
40
		return !is_null( $this->strokeOpacity ) && $this->strokeOpacity !== '';
41
	}
42
43
	public function getStrokeOpacity() {
44
		return $this->strokeOpacity;
45
	}
46
47
	public function setStrokeOpacity( $strokeOpacity ) {
48
		$this->strokeOpacity = trim( $strokeOpacity );
49
	}
50
51
	public function hasStrokeWeight() {
52
		return !is_null( $this->strokeWeight ) && $this->strokeWeight !== '';
53
	}
54
55
	public function getStrokeWeight() {
56
		return $this->strokeWeight;
57
	}
58
59
	public function setStrokeWeight( $strokeWeight ) {
60
		$this->strokeWeight = trim( $strokeWeight );
61
	}
62
63
}
64