1 | <?php |
||
31 | class ThreadActionsController |
||
32 | { |
||
33 | /** |
||
34 | * A thread status manager interface. |
||
35 | * |
||
36 | * @var ThreadStatusManagerInterface |
||
37 | */ |
||
38 | private $threadStatusManager; |
||
39 | |||
40 | /** |
||
41 | * A secure thread provider. |
||
42 | * |
||
43 | * @var SecureThreadProviderInterface |
||
44 | */ |
||
45 | private $threadProvider; |
||
46 | |||
47 | /** |
||
48 | * A participant provider instance. |
||
49 | * |
||
50 | * @var ParticipantProviderInterface |
||
51 | */ |
||
52 | private $participantProvider; |
||
53 | |||
54 | /** |
||
55 | * A flash message provider instance. |
||
56 | * |
||
57 | * @var FlashMessageProviderInterface |
||
58 | */ |
||
59 | private $flashMessageProvider; |
||
60 | |||
61 | /** |
||
62 | * A router instance. |
||
63 | * |
||
64 | * @var RouterInterface |
||
65 | */ |
||
66 | private $router; |
||
67 | /** |
||
68 | * @param ThreadStatusManagerInterface $threadStatusManager |
||
69 | * @param SecureThreadProviderInterface $threadProvider |
||
70 | * @param ParticipantProviderInterface $participantProvider |
||
71 | * @param FlashMessageProviderInterface $flashMessageProvider |
||
72 | * @param RouterInterface $router |
||
73 | */ |
||
74 | public function __construct( |
||
87 | |||
88 | /** |
||
89 | * @param Request $request |
||
90 | * |
||
91 | * @return RedirectResponse |
||
92 | */ |
||
93 | public function threadAction(Request $request) |
||
127 | |||
128 | /** |
||
129 | * Gets the thread ids from the request. |
||
130 | * |
||
131 | * @param Request $request |
||
132 | * |
||
133 | * @return array|false An array with thread ids selected or false when no thread id array given. |
||
134 | */ |
||
135 | |||
136 | protected function getThreadIdsFromRequest(Request $request) |
||
140 | |||
141 | /** |
||
142 | * Archive threads. |
||
143 | * |
||
144 | * @param array $threadIds |
||
145 | * @param ParticipantInterface $loggedInUser |
||
146 | */ |
||
147 | protected function archiveThreads($threadIds, ParticipantInterface $loggedInUser) |
||
153 | |||
154 | /** |
||
155 | * Gets the thread action from the request. |
||
156 | * |
||
157 | * @param Request $request |
||
158 | * |
||
159 | * @return string|false |
||
160 | */ |
||
161 | protected function getThreadActionFromRequest(Request $request) |
||
170 | |||
171 | /** |
||
172 | * Gets the threads from the thread ids for whom the user has access to view. |
||
173 | * |
||
174 | * @param array $threadIds |
||
175 | * @param ParticipantInterface $loggedInUser |
||
176 | * |
||
177 | * @return ThreadInterface[] An array with threadInterfaces for whom the user has permission to view them. |
||
178 | */ |
||
179 | protected function getAllowedThreads($threadIds, ParticipantInterface $loggedInUser) |
||
198 | |||
199 | /** |
||
200 | * Does the archiving of the threads by calling the thread status manager. |
||
201 | * |
||
202 | * @param array $threadIds |
||
203 | * @param ParticipantInterface $loggedInUser |
||
204 | * |
||
205 | * @return boolean true if there are threads processed, false otherwise |
||
206 | */ |
||
207 | protected function doArchiveThreads($threadIds, ParticipantInterface $loggedInUser) |
||
222 | |||
223 | /** |
||
224 | * @param boolean $processed Whether or not there where thread status updates |
||
225 | */ |
||
226 | protected function addFlashMessage($processed) |
||
240 | |||
241 | /** |
||
242 | * Redirects the user |
||
243 | * @param Request $request |
||
244 | * |
||
245 | * @return RedirectResponse |
||
246 | */ |
||
247 | private function redirectResponse(Request $request) |
||
254 | |||
255 | /** |
||
256 | * @param Request $request |
||
257 | * @return RedirectResponse |
||
258 | */ |
||
259 | protected function redirectToReferrer(Request $request) |
||
269 | } |
||
270 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: