Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
ContributeCardAction | |
0.00% |
0 / 13 |
|
0.00% |
0 / 7 |
56 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
getActionType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAction | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getActionText | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setAction | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setActionText | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
toArray | |
0.00% |
0 / 5 |
|
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 ContributeCardAction { |
24 | private string $action; |
25 | private string $actionText; |
26 | private string $actionType; |
27 | |
28 | /** |
29 | * @param string $action the action's url or command to be attached to card element |
30 | * @param string $actionText the action's text to be shown on the bottom of the card element |
31 | * @param string $actionType the action's type, specifying if it is a url or a function, ... |
32 | */ |
33 | public function __construct( string $action, string $actionText, string $actionType ) { |
34 | $this->action = $action; |
35 | $this->actionText = $actionText; |
36 | $this->actionType = $actionType; |
37 | } |
38 | |
39 | /** |
40 | * @return string |
41 | */ |
42 | public function getActionType(): string { |
43 | return $this->actionType; |
44 | } |
45 | |
46 | /** |
47 | * @return string |
48 | */ |
49 | public function getAction(): string { |
50 | return $this->action; |
51 | } |
52 | |
53 | /** |
54 | * @return string |
55 | */ |
56 | public function getActionText(): string { |
57 | return $this->actionText; |
58 | } |
59 | |
60 | /** |
61 | * @param string $action |
62 | */ |
63 | public function setAction( string $action ): void { |
64 | $this->action = $action; |
65 | } |
66 | |
67 | /** |
68 | * @param string $actionText |
69 | */ |
70 | public function setActionText( string $actionText ): void { |
71 | $this->actionText = $actionText; |
72 | } |
73 | |
74 | /** |
75 | * @return array |
76 | */ |
77 | public function toArray(): array { |
78 | return [ |
79 | 'action' => $this->action, |
80 | 'actionText' => $this->actionText, |
81 | 'actionType' => $this->actionType, |
82 | ]; |
83 | } |
84 | } |