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 | namespace MediaWiki\Specials\Contribute\Card; |
4 | |
5 | class ContributeCardAction { |
6 | /** @var string */ |
7 | private $action; |
8 | |
9 | /** @var string */ |
10 | private $actionText; |
11 | |
12 | /** @var string */ |
13 | private $actionType; |
14 | |
15 | /** |
16 | * @param string $action the action's url or command to be attached to card element |
17 | * @param string $actionText the action's text to be shown on the bottom of the card element |
18 | * @param string $actionType the action's type, specifying if it is a url or a function, ... |
19 | */ |
20 | public function __construct( string $action, string $actionText, string $actionType ) { |
21 | $this->action = $action; |
22 | $this->actionText = $actionText; |
23 | $this->actionType = $actionType; |
24 | } |
25 | |
26 | /** |
27 | * @return string |
28 | */ |
29 | public function getActionType(): string { |
30 | return $this->actionType; |
31 | } |
32 | |
33 | /** |
34 | * @return string |
35 | */ |
36 | public function getAction(): string { |
37 | return $this->action; |
38 | } |
39 | |
40 | /** |
41 | * @return string |
42 | */ |
43 | public function getActionText(): string { |
44 | return $this->actionText; |
45 | } |
46 | |
47 | /** |
48 | * @param string $action |
49 | */ |
50 | public function setAction( string $action ): void { |
51 | $this->action = $action; |
52 | } |
53 | |
54 | /** |
55 | * @param string $actionText |
56 | */ |
57 | public function setActionText( string $actionText ): void { |
58 | $this->actionText = $actionText; |
59 | } |
60 | |
61 | /** |
62 | * @return array |
63 | */ |
64 | public function toArray(): array { |
65 | return [ |
66 | 'action' => $this->action, |
67 | 'actionText' => $this->actionText, |
68 | 'actionType' => $this->actionType, |
69 | ]; |
70 | } |
71 | } |