Code Duplication    Length = 42-45 lines in 2 locations

www/engine/System/Classes/Addons/Contact/Handler.php 1 location

@@ 7-48 (lines=42) @@
4
5
	use Frames, Modules\Auth, Utils\Messages, Utils\View, Language, Request;
6
7
	class Handler extends Frames\Site\Area\Common {
8
9
		protected $title = 'TITLE_CONTACT';
10
11
		private $form = null;
12
13
		# Get contents
14
15
		private function getContents() {
16
17
			$contents = View::get('Blocks/Contact/Contact');
18
19
			# Implement form
20
21
			$this->form->implement($contents);
22
23
			# ------------------------
24
25
			return $contents;
26
		}
27
28
		# Handle request
29
30
		protected function handle() {
31
32
			# Create form
33
34
			$this->form = new Form;
35
36
			# Handle form
37
38
			if ($this->form->handle(new Controller)) Request::redirect(INSTALL_PATH . '/contact?submitted');
39
40
			# Display success message
41
42
			if (false !== Request::get('submitted')) Messages::set('success', Language::get('CONTACT_SUCCESS_SEND'));
43
44
			# ------------------------
45
46
			return $this->getContents();
47
		}
48
	}
49
}
50

www/engine/System/Classes/Modules/Settings/Handler/General.php 1 location

@@ 7-51 (lines=45) @@
4
5
	use Frames, Modules\Settings, Utils\Popup, Utils\View, Language, Request;
6
7
	class General extends Frames\Admin\Area\Authorized {
8
9
		protected $title = 'TITLE_SYSTEM_SETTINGS';
10
11
		private $form = null;
12
13
		# Get contents
14
15
		private function getContents() {
16
17
			$contents = View::get('Blocks/Settings/General');
18
19
			# Implement form
20
21
			$this->form->implement($contents);
22
23
			# ------------------------
24
25
			return $contents;
26
		}
27
28
		# Handle request
29
30
		protected function handle() {
31
32
			# Create form
33
34
			$this->form = new Settings\Form\General;
35
36
			# Handle form
37
38
			if ($this->form->handle(new Settings\Controller\General, true)) {
39
40
				Request::redirect(INSTALL_PATH . '/admin/system/settings?submitted');
41
			}
42
43
			# Display success message
44
45
			if (false !== Request::get('submitted')) Popup::set('positive', Language::get('SETTINGS_SUCCESS'));
46
47
			# ------------------------
48
49
			return $this->getContents();
50
		}
51
	}
52
}
53