Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 25 |
|
0.00% |
0 / 11 |
CRAP | |
0.00% |
0 / 1 |
MassMessageRequest | |
0.00% |
0 / 25 |
|
0.00% |
0 / 11 |
132 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
getSpamList | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSubject | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPageMessage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPageMessageSection | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPageSubjectSection | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getMessage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getComment | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
hasPageMessage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
hasMessage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSerializedData | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | declare( strict_types = 1 ); |
3 | |
4 | namespace MediaWiki\MassMessage\RequestProcessing; |
5 | |
6 | use MediaWiki\Title\Title; |
7 | |
8 | /** |
9 | * Represents a request submitted by user for sending a mass message |
10 | * @author Abijeet Patro |
11 | * @since 2021.12 |
12 | * @license GPL-2.0-or-later |
13 | */ |
14 | class MassMessageRequest { |
15 | /** @var Title */ |
16 | private $spamList; |
17 | /** @var string */ |
18 | private $subject; |
19 | /** @var string */ |
20 | private $pageMessage; |
21 | /** @var string */ |
22 | private $pageMessageSection; |
23 | /** @var string */ |
24 | private $pageSubjectSection; |
25 | /** @var string */ |
26 | private $message; |
27 | /** @var string[] */ |
28 | private $comment; |
29 | |
30 | /** |
31 | * @param Title $spamList |
32 | * @param string $subject |
33 | * @param string $pageMessage |
34 | * @param string $pageMessageSection |
35 | * @param string $pageSubjectSection |
36 | * @param string $message |
37 | * @param string[] $comment |
38 | */ |
39 | public function __construct( |
40 | Title $spamList, |
41 | string $subject, |
42 | string $pageMessage, |
43 | string $pageMessageSection, |
44 | string $pageSubjectSection, |
45 | string $message, |
46 | array $comment |
47 | ) { |
48 | $this->spamList = $spamList; |
49 | $this->subject = $subject; |
50 | $this->pageMessage = $pageMessage; |
51 | $this->pageMessageSection = $pageMessageSection; |
52 | $this->pageSubjectSection = $pageSubjectSection; |
53 | $this->message = $message; |
54 | $this->comment = $comment; |
55 | } |
56 | |
57 | /** @return Title */ |
58 | public function getSpamList(): Title { |
59 | return $this->spamList; |
60 | } |
61 | |
62 | /** @return string */ |
63 | public function getSubject(): string { |
64 | return $this->subject; |
65 | } |
66 | |
67 | /** @return string */ |
68 | public function getPageMessage(): string { |
69 | return $this->pageMessage; |
70 | } |
71 | |
72 | /** @return string */ |
73 | public function getPageMessageSection(): string { |
74 | return $this->pageMessageSection; |
75 | } |
76 | |
77 | /** @return string */ |
78 | public function getPageSubjectSection(): string { |
79 | return $this->pageSubjectSection; |
80 | } |
81 | |
82 | /** @return string */ |
83 | public function getMessage(): string { |
84 | return $this->message; |
85 | } |
86 | |
87 | /** @return string[] */ |
88 | public function getComment(): array { |
89 | return $this->comment; |
90 | } |
91 | |
92 | /** @return bool */ |
93 | public function hasPageMessage(): bool { |
94 | return $this->pageMessage !== ''; |
95 | } |
96 | |
97 | /** @return bool */ |
98 | public function hasMessage(): bool { |
99 | return $this->message !== ''; |
100 | } |
101 | |
102 | /** @return array */ |
103 | public function getSerializedData(): array { |
104 | return [ |
105 | 'spamList' => $this->getSpamList()->getPrefixedText(), |
106 | 'subject' => $this->getSubject(), |
107 | 'page-message' => $this->getPageMessage(), |
108 | 'page-message-section' => $this->getPageMessageSection(), |
109 | 'page-subject-section' => $this->getPageSubjectSection(), |
110 | 'message' => $this->getMessage(), |
111 | 'comment' => $this->getComment() |
112 | ]; |
113 | } |
114 | } |