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::setFunctionSearch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
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
}