BaseElement   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 57.14%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 0
dl 0
loc 46
ccs 12
cts 21
cp 0.5714
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setTitle() 0 3 1
A setText() 0 3 1
A setLink() 0 3 1
A getArrayValue() 0 3 1
A getJSONObject() 0 7 1
A getText() 0 3 1
A getTitle() 0 3 1
A getLink() 0 3 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace Maps\LegacyModel;
6
7
/**
8
 * @since 3.0
9
 *
10
 * @licence GNU GPL v2+
11
 * @author Kim Eik < [email protected] >
12
 * @author Jeroen De Dauw < [email protected] >
13
 */
14
abstract class BaseElement {
15
16
	private $title;
17
	private $text;
18
	private $link;
19
20 78
	public function setTitle( string $title ) {
21 78
		$this->title = trim( $title );
22 78
	}
23
24 76
	public function setText( string $text ) {
25 76
		$this->text = trim( $text );
26 76
	}
27
28
	public function setLink( string $link ) {
29
		$this->link = $link;
30
	}
31
32 5
	public function getArrayValue() {
33 5
		return $this->getJSONObject();
0 ignored issues
show
Deprecated Code introduced by
The method Maps\LegacyModel\BaseElement::getJSONObject() has been deprecated.

This method has been deprecated.

Loading history...
34
	}
35
36
	/**
37
	 * @deprecated
38
	 */
39 23
	public function getJSONObject( string $defText = '', string $defTitle = '' ): array {
40
		return [
41 23
			'text' => $this->text ?? $defText,
42 23
			'title' => $this->title ?? $defTitle,
43 23
			'link' => $this->link ?? '',
44
		];
45
	}
46
47
	public function getText(): string {
48
		return $this->text ?? '';
49
	}
50
51
	public function getTitle(): string {
52
		return $this->title ?? '';
53
	}
54
55
	public function getLink(): string {
56
		return $this->link ?? '';
57
	}
58
59
}
60