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

Geography::init()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
rs 9.4285
c 1
b 0
f 0
cc 3
eloc 9
nc 4
nop 0
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