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

Handler   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 7
dl 42
loc 42
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContents() 12 12 1
A handle() 18 18 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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