Test Failed
Push — master ( afc6d5...e64a49 )
by Alexey
04:08
created

SearchController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
B indexAction() 0 16 5
1
<?php
2
3
/**
4
 * INJI
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2017 Alexey Krupskiy
9
 * @license https://github.com/injitools/Inji/blob/master/LICENSE
10
 */
11
class SearchController extends Controller {
12
    function indexAction() {
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...
13
        //$_GET['search']
14
        $this->view->setTitle('Поиск по сайту');
15
        $map = [];
16
        if (!empty($_GET['search']) && is_string($_GET['search'])) {
17
18
            $modules = Module::getInstalled(App::$primary);
19
20
            foreach ($modules as $module) {
21
                if (method_exists(App::$cur->$module, 'siteSearch')) {
22
                    $map[$module] = App::$cur->$module->siteSearch($_GET['search']);
23
                }
24
            }
25
        }
26
        $this->view->page(['data' => ['map' => $map]]);
27
    }
28
}