Code Duplication    Length = 17-20 lines in 4 locations

app/presenters/RegistrationPresenter.php 2 locations

@@ 104-121 (lines=18) @@
101
	 *
102
	 * @return void
103
	 */
104
	public function actionCreate()
105
	{
106
		try {
107
			$postData = $this->getRequest()->getPost();
108
			$postData['meeting'] = $this->getMeetingId();
109
110
			$guid = $this->getVisitorService()->create($postData);
111
			$result = $this->sendRegistrationSummary($postData, $guid);
112
113
			Debugger::log('Creation of registration('. $guid .') successfull, result: ' . json_encode($result), Debugger::INFO);
114
			$this->flashMessage('Registrace(' . $guid . ') byla úspěšně založena.', 'ok');
115
		} catch(Exception $e) {
116
			Debugger::log('Creation of registration('. $guid .') failed, result: ' .  $e->getMessage(), Debugger::ERROR);
117
			$this->flashMessage('Creation of registration failed, result: ' . $e->getMessage(), 'error');
118
		}
119
120
		$this->redirect('Registration:check', $guid);
121
	}
122
123
	/**
124
	 * @param  integer 	$id
@@ 127-143 (lines=17) @@
124
	 * @param  integer 	$id
125
	 * @return void
126
	 */
127
	public function actionUpdate($guid)
128
	{
129
		try {
130
			$postData = $this->getRequest()->getPost();
131
132
			$result = $this->getVisitorService()->update($guid, $postData);
133
			$result = $this->sendRegistrationSummary($postData, $guid);
134
135
			Debugger::log('Modification of registration('. $guid .') successfull, result: ' . json_encode($result), Debugger::INFO);
136
			$this->flashMessage('Registrace(' . $guid . ') byla úspěšně upravena.', 'ok');
137
		} catch(Exception $e) {
138
			Debugger::log('Modification of registration('. $guid .') failed, result: ' .  $e->getMessage(), Debugger::ERROR);
139
			$this->flashMessage('Modification of registration(' . $guid . ') failed, result: ' . $e->getMessage(), 'error');
140
		}
141
142
		$this->redirect('Registration:check', $guid);
143
	}
144
145
	/**
146
	 * @return void

app/presenters/VisitorPresenter.php 2 locations

@@ 97-114 (lines=18) @@
94
	 *
95
	 * @return void
96
	 */
97
	public function actionCreate()
98
	{
99
		try {
100
			$postData = $this->getRequest()->getPost();
101
			$postData['meeting'] = $this->getMeetingId();
102
103
			$guid = $this->getVisitorService()->create($postData);
104
			$result = $this->sendRegistrationSummary($postData, $guid);
105
106
			Debugger::log('Creation of visitor('. $guid .') successfull, result: ' . json_encode($result), Debugger::INFO);
107
			$this->flashMessage('Účastník(' . $guid . ') byl úspěšně upraven.', 'ok');
108
		} catch(Exception $e) {
109
			Debugger::log('Creation of visitor('. $guid .') failed, result: ' .  $e->getMessage(), Debugger::ERROR);
110
			$this->flashMessage('Creation of visitor failed, result: ' . $e->getMessage(), 'error');
111
		}
112
113
		$this->redirect('Visitor:listing');
114
	}
115
116
	/**
117
	 * Process data from editing
@@ 122-141 (lines=20) @@
119
	 * @param  integer 	$id
120
	 * @return void
121
	 */
122
	public function actionUpdate($id)
123
	{
124
		try {
125
			$postData = $this->getRequest()->getPost();
126
			$postData['meeting'] = $this->getMeetingId();
127
			$postData['visitor'] = $id;
128
129
			$result = $this->getVisitorService()->update($id, $postData);
130
131
			//$result = $this->sendRegistrationSummary($visitor, $guid);
132
133
			Debugger::log('Modification of visitor('. $id .') successfull, result: ' . json_encode($result), Debugger::INFO);
134
			$this->flashMessage('Účastník(' . $id . ') byl úspěšně upraven.', 'ok');
135
		} catch(Exception $e) {
136
			Debugger::log('Modification of visitor('. $id .') failed, result: ' .  $e->getMessage(), Debugger::ERROR);
137
			$this->flashMessage('Modification of visitor failed, result: ' . $e->getMessage(), 'error');
138
		}
139
140
		$this->redirect('Visitor:listing');
141
	}
142
143
	/**
144
	 * @param  int  $id