Completed
Push — master ( 594f71...a14e49 )
by Alexey
05:31
created

Geography   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 17
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 13 3
1
<?php
2
3
/**
4
 * Geography module
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2016 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
class Geography extends Module
12
{
13
    function init()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
14
    {
15
        $alias = str_replace(App::$cur->config['site']['domain'], '', INJI_DOMAIN_NAME);
16
        $city = null;
17
        if ($alias) {
18
            $alias = str_replace('.', '', $alias);
19
            $city = Geography\City::get($alias, 'alias');
20
        }
21
        if (!$city) {
22
            $city = Geography\City::get(1, 'default');
23
        }
24
        Geography\City::$cur = $city;
25
    }
26
27
}
28