Conditions | 3 |
Paths | 4 |
Total Lines | 27 |
Code Lines | 8 |
Lines | 4 |
Ratio | 14.81 % |
Changes | 0 |
1 | <?php |
||
20 | public function route() { |
||
21 | |||
22 | # Check installation |
||
23 | |||
24 | View Code Duplication | if (null === ($data = Schema::get('System')->load())) { |
|
|
|||
25 | |||
26 | Request::redirect(INSTALL_PATH . '/install.php'); |
||
27 | } |
||
28 | |||
29 | # Connect to database |
||
30 | |||
31 | DB::connect(...array_values($data['database'])); |
||
32 | |||
33 | # Init addons |
||
34 | |||
35 | Extend\Addons::init(); |
||
36 | |||
37 | # Get handler class by requested url |
||
38 | |||
39 | $handler = Map::handler($url = new Url(Request::get('url'))); |
||
40 | |||
41 | $class = ((false !== $handler) ? $handler : 'Modules\Page'); |
||
42 | |||
43 | # ------------------------ |
||
44 | |||
45 | new $class($url); |
||
46 | } |
||
47 | } |
||
49 |
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.