ResultListWidget   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 34
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 9 2
1
<?php
2
/**
3
 *
4
 * @author Mihkel Viilveer <[email protected]>
5
 * @date 3.09.2014
6
 */
7
8
namespace opus\elastic\search;
9
10
11
use yii\base\Widget;
12
13
/**
14
 * Widget renders all the AbstractHit objects
15
 * Class ResultListWidget
16
 *
17
 * @author Mihkel Viilveer <[email protected]>
18
 * @package opus\elastic\search
19
 */
20
class ResultListWidget extends Widget
21
{
22
    /**
23
     * @var AbstractResultWidget[]
24
     */
25
    public $items = [];
26
27
    /**
28
     * Hit view path hint
29
     * @var string
30
     */
31
    public $resultViewPath = null;
32
33
    /**
34
     * Custom view params
35
     * @var array
36
     */
37
    public $params = [];
38
39
    /**
40
     * Applies template hint to hit and renders it
41
     * @return null|string
42
     */
43
    public function run()
44
    {
45
        $listHtml = null;
46
        foreach ($this->items as $item) {
47
            $item->setViewPath($this->resultViewPath);
48
            $listHtml .= $item->render($item->getViewFilePath(), $this->params);
49
        }
50
        return $listHtml;
51
    }
52
53
} 
54