Completed
Push — cleanz ( d9e779 )
by Jeroen De
06:06
created

BaseElement::getOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Maps\Elements;
4
5
/**
6
 * @since 3.0
7
 *
8
 * @licence GNU GPL v2+
9
 * @author Kim Eik < [email protected] >
10
 * @author Jeroen De Dauw < [email protected] >
11
 */
12
abstract class BaseElement {
13
14
	private $title;
15
	private $text;
16
	private $link;
17
18 8
	public function setTitle( string $title ) {
19 8
		$this->title = trim( $title );
20 8
	}
21
22 5
	public function setText( string $text ) {
23 5
		$this->text = trim( $text );
24 5
	}
25
26
	public function setLink( string $link ) {
27
		$this->link = $link;
28
	}
29
30 5
	public function getArrayValue() {
31 5
		return $this->getJSONObject();
0 ignored issues
show
Deprecated Code introduced by
The method Maps\Elements\BaseElement::getJSONObject() has been deprecated.

This method has been deprecated.

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