Completed
Push — master ( 81538e...c2bf57 )
by Jeroen De
10:06
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
declare( strict_types = 1 );
4
5
namespace Maps\LegacyModel;
6
7
/**
8
 * @since 2.0
9
 *
10
 * @licence GNU GPL v2+
11
 * @author Kim Eik < [email protected] >
12
 */
13
class BaseStrokableElement extends BaseElement {
14
15
	protected $strokeColor;
16
	protected $strokeOpacity;
17
	protected $strokeWeight;
18
19
	public function getJSONObject( string $defText = '', string $defTitle = '' ): array {
20
		$parentArray = parent::getJSONObject( $defText, $defTitle );
0 ignored issues
show
Deprecated Code introduced by
The method Maps\LegacyModel\BaseElement::getJSONObject() has been deprecated.

This method has been deprecated.

Loading history...
21
		$array = [
22
			'strokeColor' => $this->hasStrokeColor() ? $this->getStrokeColor() : '#FF0000',
23
			'strokeOpacity' => $this->hasStrokeOpacity() ? $this->getStrokeOpacity() : '1',
24
			'strokeWeight' => $this->hasStrokeWeight() ? $this->getStrokeWeight() : '2'
25
		];
26
		return array_merge( $parentArray, $array );
27
	}
28
29
	public function hasStrokeColor() {
30
		return !is_null( $this->strokeColor ) && $this->strokeColor !== '';
31
	}
32
33
	public function getStrokeColor() {
34
		return $this->strokeColor;
35
	}
36
37
	public function setStrokeColor( $strokeColor ) {
38
		$this->strokeColor = trim( $strokeColor );
39
	}
40
41
	public function hasStrokeOpacity() {
42
		return !is_null( $this->strokeOpacity ) && $this->strokeOpacity !== '';
43
	}
44
45
	public function getStrokeOpacity() {
46
		return $this->strokeOpacity;
47
	}
48
49
	public function setStrokeOpacity( $strokeOpacity ) {
50
		$this->strokeOpacity = trim( $strokeOpacity );
51
	}
52
53
	public function hasStrokeWeight() {
54
		return !is_null( $this->strokeWeight ) && $this->strokeWeight !== '';
55
	}
56
57
	public function getStrokeWeight() {
58
		return $this->strokeWeight;
59
	}
60
61
	public function setStrokeWeight( $strokeWeight ) {
62
		$this->strokeWeight = trim( $strokeWeight );
63
	}
64
65
}
66