Completed
Push — development ( eb9524...db4517 )
by Andrij
28:49 queued 02:09
created

DelegationFinder   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 18 2
1
<?php
2
3
namespace xbanners\src\UrlFinder;
4
5
use xbanners\src\UrlFinder\Finders\BaseFinder;
6
use xbanners\src\UrlFinder\Finders\Brands;
7
use xbanners\src\UrlFinder\Finders\PageCategories;
8
use xbanners\src\UrlFinder\Finders\Pages;
9
use xbanners\src\UrlFinder\Finders\ProductCategories;
10
use xbanners\src\UrlFinder\Finders\Products;
11
12
class DelegationFinder extends BaseFinder
13
{
0 ignored issues
show
introduced by
Opening brace of a class must be on the same line as the definition
Loading history...
14
15
    /**
16
     * @var BaseFinder[]
17
     */
18
    protected $finders = [];
19
20
    public function __construct() {
21
        if (\MY_Controller::isCorporateCMS()) {
22
            $this->finders = [
23
                new Pages(),
24
                new PageCategories(),
25
26
            ];
27
        } else {
28
            $this->finders = [
29
                new Brands(),
30
                new Products(),
31
                new ProductCategories(),
32
                new Pages(),
33
                new PageCategories(),
34
            ];
35
36
        }
37
    }
38
39
    /**
40
     * @param string $word
41
     * @return ResultsCollection
42
     */
43
    public function getResultsFor($word, $language, $limit = 10) {
44
        $results = new ResultsCollection();
45
        foreach ($this->finders as $finder) {
46
            $results->addResult($finder->getResultsFor($word, $language, $limit));
47
        }
48
        return $results;
49
    }
50
51
    public function getGroupName() {
52
        return null;
53
    }
54
55
    public function formUrl($url) {
56
        return null;
57
    }
58
59
}