Passed
Push — master ( a357e7...195a07 )
by Anton
04:22 queued 01:11
created

Handler::handle()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 18
Code Lines 5

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
dl 18
loc 18
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 4
nop 0
1
<?php
2
3
namespace Addons\Contact {
4
5
	use Frames, Modules\Auth, Utils\Messages, Utils\View, Language, Request;
6
7 View Code Duplication
	class Handler extends Frames\Site\Area\Common {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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