Passed
Push — master ( e0d6a2...2ec881 )
by Anton
05:25 queued 02:20
created

Installer::handle()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 19
Code Lines 6

Duplication

Lines 4
Ratio 21.05 %

Importance

Changes 0
Metric Value
dl 4
loc 19
rs 9.2
c 0
b 0
f 0
cc 4
eloc 6
nc 8
nop 0
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())) {
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
				Request::redirect(INSTALL_PATH . '/index.php');
27
			}
28
29
			# Get handler class
30
31
			$checked = (Install::checkRequirements() && Validate::boolean(Request::get('checked')));
32
33
			$class = ('Modules\Install\Handler\\' . (!$checked ? 'Check' : 'Database'));
34
35
			# ------------------------
36
37
			new $class;
38
		}
39
	}
40
}
41