Installer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 17.39 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
dl 4
loc 23
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A route() 4 16 4

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
/**
4
 * @package Cadmium\System
5
 * @author Anton Romanov
6
 * @copyright Copyright (c) 2015-2017, Anton Romanov
7
 * @link http://cadmium-cms.com
8
 */
9
10
namespace {
11
12
	use Modules\Install, Utils\Schema;
13
14
	class Installer {
15
16
		/**
17
		 * Route a request to a handler
18
		 */
19
20
		public function route() {
21
22
			# Check installation
23
24 View Code Duplication
			if (null !== ($data = Schema::get('System')->load())) Request::redirect(INSTALL_PATH . '/index.php');
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
25
26
			# Get handler class
27
28
			$checked = (Install::checkRequirements() && Validate::boolean(Request::get('checked')));
29
30
			$class = ('Modules\Install\Handler\\' . (!$checked ? 'Check' : 'Database'));
31
32
			# ------------------------
33
34
			new $class;
35
		}
36
	}
37
}
38