Code Duplication    Length = 26-27 lines in 2 locations

app/presenters/BlockPresenter.php 1 location

@@ 214-240 (lines=27) @@
211
	/**
212
	 * @return BlockForm
213
	 */
214
	protected function createComponentBlockForm(): BlockForm
215
	{
216
		$control = $this->blockFormFactory->create();
217
		$control->setMeetingId($this->getMeetingId());
218
		$control->onBlockSave[] = function(BlockForm $control, $block) {
219
			//$guid = $this->getParameter('guid');
220
			$id = $this->getParameter('id');
221
222
			$this->setBacklinkFromArray($block);
223
224
			if($id) {
225
				$this->actionUpdate($id, $block);
226
			} else {
227
				$this->actionCreate($block);
228
			}
229
230
			$this->redirect($this->getBacklink() ?: self::REDIRECT_DEFAULT);
231
		};
232
233
		$control->onBlockReset[] = function(BlockForm $control, $block) {
234
			$this->setBacklinkFromArray($block);
235
236
			$this->redirect($this->getBacklink() ?: self::REDIRECT_DEFAULT);
237
		};
238
239
		return $control;
240
	}
241
242
	/**
243
	 * @return Emailer

app/presenters/VisitorPresenter.php 1 location

@@ 348-373 (lines=26) @@
345
	/**
346
	 * @return VisitorFormControl
347
	 */
348
	protected function createComponentVisitorForm(): VisitorForm
349
	{
350
		$control = $this->visitorFormFactory->create();
351
		$control->setMeetingId($this->getMeetingId());
352
353
		$control->onVisitorSave[] = function(VisitorForm $control, $visitor) {
354
			$id = $this->getParameter('id');
355
			$this->setBacklinkFromArray($visitor);
356
357
			if($id) {
358
				$this->actionUpdate($id, $visitor);
359
			} else {
360
				$this->actionCreate($visitor);
361
			}
362
363
			$this->redirect($this->getBacklink() ?: self::REDIRECT_DEFAULT);
364
		};
365
366
		$control->onVisitorReset[] = function(VisitorForm $control, $visitor) {
367
			$this->setBacklinkFromArray($visitor);
368
369
			$this->redirect($this->getBacklink() ?: self::REDIRECT_DEFAULT);
370
		};
371
372
		return $control;
373
	}
374
375
	/**
376
	 * @return Latte