These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare( strict_types = 1 ); |
||
4 | |||
5 | namespace Maps\Elements; |
||
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 | 77 | public function setTitle( string $title ) { |
|
21 | 77 | $this->title = trim( $title ); |
|
22 | 77 | } |
|
23 | |||
24 | 75 | public function setText( string $text ) { |
|
25 | 75 | $this->text = trim( $text ); |
|
26 | 75 | } |
|
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
|
|||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @deprecated |
||
38 | */ |
||
39 | 22 | public function getJSONObject( string $defText = '', string $defTitle = '' ): array { |
|
40 | return [ |
||
41 | 22 | 'text' => $this->text ?? $defText, |
|
42 | 22 | 'title' => $this->title ?? $defTitle, |
|
43 | 22 | '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 |
This method has been deprecated.