BaseElement::getArrayValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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