Code Duplication    Length = 24-25 lines in 2 locations

app/presenters/VisitorPresenter.php 2 locations

@@ 195-218 (lines=24) @@
192
	 * @param  integer|string $ids
193
	 * @return void
194
	 */
195
	public function actionPay($id)
196
	{
197
		try {
198
			if(!$id) {
199
				$id = $this->getHttpRequest()->getPost('checker');
200
			}
201
202
			$visitor = $this->getVisitorRepository();
203
			$visitor->payCostCharge($id);
204
			$recipients = $visitor->findRecipients($id);
205
			$this->getEmailer()->sendPaymentInfo($recipients, 'cost');
206
207
			$this->logInfo('Visitor: Action pay cost for id %s executed successfully.', [json_encode($id)]);
208
			$this->flashSuccess('Platba byla zaplacena.');
209
		} catch(Exception $e) {
210
			$this->logError('Visitor: Action pay for id %s failed, result: %s', [
211
			    json_encode($id),
212
                $e->getMessage()
213
            ]);
214
			$this->flashFailure('Visitor: Action pay for id ' . $id . ' failed, result: ' . $e->getMessage());
215
		}
216
217
		$this->redirect(self::REDIRECT_DEFAULT);
218
	}
219
220
	/**
221
	 * @param  string|interger $ids
@@ 224-248 (lines=25) @@
221
	 * @param  string|interger $ids
222
	 * @return void
223
	 */
224
	public function actionAdvance(int $id = null)
225
	{
226
		try {
227
			if(!$id) {
228
				$id = $this->getHttpRequest()->getPost('checker');
229
			}
230
231
			$visitor = $this->getVisitorRepository();
232
			$visitor->payAdvanceCharge($id);
233
			$recipients = $visitor->findRecipients($id);
234
			$this->getEmailer()->sendPaymentInfo($recipients, 'advance');
235
236
			$this->logInfo('Visitor: Action pay advance for id %s executed successfully.', [json_encode($id)]);
237
			$this->flashSuccess('Záloha byla zaplacena.');
238
		} catch(Exception $e) {
239
			$this->logError(
240
				'Visitor: Action pay advance for id %s failed, result: %s', [
241
					json_encode($id),
242
					$e->getMessage(),
243
				]);
244
			$this->flashFailure('Zaplacení zálohy pro účastníka s id '.json_encode($id).' neprošlo: '.$e->getMessage());
245
		}
246
247
		$this->redirect(self::REDIRECT_DEFAULT);
248
	}
249
250
	/**
251
	 * Set item as checked by id