Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 10 |
CRAP | |
0.00% |
0 / 1 |
ContributeCard | |
0.00% |
0 / 18 |
|
0.00% |
0 / 10 |
110 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
getTitle | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setTitle | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getIcon | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setIcon | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDescription | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setDescription | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAction | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setAction | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
toArray | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License along |
14 | * with this program; if not, write to the Free Software Foundation, Inc., |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | * http://www.gnu.org/copyleft/gpl.html |
17 | * |
18 | * @file |
19 | */ |
20 | |
21 | namespace MediaWiki\Specials\Contribute\Card; |
22 | |
23 | class ContributeCard { |
24 | private string $title; |
25 | private string $icon; |
26 | private string $description; |
27 | private ContributeCardAction $action; |
28 | |
29 | public function __construct( string $title, string $description, string $icon, ContributeCardAction $action ) { |
30 | $this->title = $title; |
31 | $this->icon = $icon; |
32 | $this->description = $description; |
33 | $this->action = $action; |
34 | } |
35 | |
36 | /** |
37 | * @return string |
38 | */ |
39 | public function getTitle(): string { |
40 | return $this->title; |
41 | } |
42 | |
43 | /** |
44 | * @param string $title |
45 | */ |
46 | public function setTitle( string $title ): void { |
47 | $this->title = $title; |
48 | } |
49 | |
50 | /** |
51 | * @return string |
52 | */ |
53 | public function getIcon(): string { |
54 | return $this->icon; |
55 | } |
56 | |
57 | /** |
58 | * @param string $icon |
59 | */ |
60 | public function setIcon( string $icon ): void { |
61 | $this->icon = $icon; |
62 | } |
63 | |
64 | /** |
65 | * @return string |
66 | */ |
67 | public function getDescription(): string { |
68 | return $this->description; |
69 | } |
70 | |
71 | /** |
72 | * @param string $description |
73 | */ |
74 | public function setDescription( string $description ): void { |
75 | $this->description = $description; |
76 | } |
77 | |
78 | /** |
79 | * @return ContributeCardAction |
80 | */ |
81 | public function getAction(): ContributeCardAction { |
82 | return $this->action; |
83 | } |
84 | |
85 | /** |
86 | * @param ContributeCardAction $action |
87 | */ |
88 | public function setAction( ContributeCardAction $action ): void { |
89 | $this->action = $action; |
90 | } |
91 | |
92 | /** |
93 | * @return array |
94 | */ |
95 | public function toArray(): array { |
96 | return [ |
97 | 'title' => $this->title, |
98 | 'icon' => $this->icon, |
99 | 'description' => $this->description, |
100 | 'action' => $this->action->toArray() |
101 | ]; |
102 | } |
103 | } |