GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Setup Failed
Push — filters ( d405d9...e854eb )
by
unknown
09:25
created

SearchEvent   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 5
Bugs 2 Features 1
Metric Value
wmc 6
c 5
b 2
f 1
lcom 1
cbo 0
dl 0
loc 56
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getFunctionSearch() 0 4 1
A setFunctionSearch() 0 4 1
A init() 0 9 2
A getAll() 0 9 2
1
<?php
2
3
namespace app\components\search;
4
5
6
use yii\base\Event;
7
use yii\db\ActiveQuery;
8
use yii\helpers\ArrayHelper;
9
10
class SearchEvent extends Event
11
{
12
13
    /**
14
     * @var ActiveQuery
15
     */
16
    public $activeQuery = null;
17
    /**
18
     * @var string
19
     */
20
    public $q = null;
21
    /**
22
     * @var callable
23
     */
24
    protected $functionSearch = null;
25
26
    /**
27
     * @return callable
28
     */
29
    public function getFunctionSearch()
30
    {
31
        return $this->functionSearch;
32
    }
33
34
    /**
35
     * @param callable $functionSearch
36
     */
37
    public function setFunctionSearch(callable $functionSearch)
38
    {
39
        $this->functionSearch = $functionSearch;
40
    }
41
42
    public function init()
43
    {
44
        if ($this->functionSearch === null) {
45
            $this->setFunctionSearch(function ($activeQuery) {
46
                return ArrayHelper::getColumn($activeQuery->all(), 'id');
47
            });
48
        }
49
        parent::init();
50
    }
51
52
    /**
53
     * @return array
54
     */
55
    public function getAll()
56
    {
57
        $result = [];
58
        if (is_callable($this->functionSearch)) {
59
            $method = $this->functionSearch;
60
            $result = $method($this->activeQuery);
61
        }
62
        return $result;
63
    }
64
65
}