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 — master ( e91cf6...3a6b3f )
by Alexander
10:43
created

ContentBlock::getChunk()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
3
namespace app\modules\core\models;
4
5
use app\modules\core\helpers\ContentBlockHelper;
6
use devgroup\TagDependencyHelper\ActiveRecordHelper;
7
use yii\caching\TagDependency;
8
use yii\data\ActiveDataProvider;
9
use Yii;
10
11
/**
12
 * This is the model class for table "content_block".
13
 * @property integer $id
14
 * @property string $name
15
 * @property string $key
16
 * @property string $value
17
 * @property integer $preload
18
 * @property integer $group_id
19
 */
20
class ContentBlock extends \yii\db\ActiveRecord
21
{
22
23
    /**
24
     * @var null|string
25
     */
26
    public $newGroup = null;
27
28
    /**
29
     * @inheritdoc
30
     */
31
    public static function tableName()
32
    {
33
        return 'content_block';
34
    }
35
36
    /**
37
     * @inheritdoc
38
     */
39
    public function rules()
40
    {
41
        return [
42
            [['value'], 'string'],
43
            [['preload', 'group_id'], 'integer'],
44
            [['key'], 'unique'],
45
            [['group_id'], 'default', 'value' => 1],
46
            [['name', 'key'], 'string', 'max' => 255],
47
            [['newGroup'], 'safe']
48
        ];
49
    }
50
51
    /**
52
     * @inheritdoc
53
     */
54 View Code Duplication
    public function attributeLabels()
55
    {
56
        return [
57
            'id' => 'ID',
58
            'name' => Yii::t('app', 'Name'),
59
            'key' => Yii::t('app', 'Key'),
60
            'value' => Yii::t('app', 'Value'),
61
            'preload' => Yii::t('app', 'Preload'),
62
            'group_id' => Yii::t('app', 'Group Id'),
63
            'newGroup' => Yii::t('app', 'New Group'),
64
        ];
65
    }
66
67
    /**
68
     * @inheritdoc
69
     */
70
    public function behaviors()
71
    {
72
        return [
73
            [
74
                'class' => ActiveRecordHelper::className(),
75
            ],
76
        ];
77
    }
78
79
    /**
80
     * @param $params
81
     * @return ActiveDataProvider
82
     */
83
    public function search($params)
84
    {
85
        /* @var $query \yii\db\ActiveQuery */
86
        $query = self::find();
87
88
        if ($this->group_id) {
89
            $query->andWhere(['group_id' => $this->group_id]);
90
        }
91
92
        $dataProvider = new ActiveDataProvider(
93
            [
94
                'query' => $query,
95
                'pagination' => [
96
                    'pageSize' => 10,
97
                ],
98
            ]
99
        );
100
        if (!($this->load($params))) {
101
            return $dataProvider;
102
        }
103
        $query->andFilterWhere(['id' => $this->id]);
104
        $query->andFilterWhere(['like', 'name', $this->name]);
105
        $query->andFilterWhere(['like', 'key', $this->key]);
106
        $query->andFilterWhere(['preload' => $this->preload]);
107
        return $dataProvider;
108
    }
109
110
    /**
111
     * @deprecated use ContentBlockHelper::getChunk($key, $params, $model) instead
112
     * Get chunk model or value
113
     * @param string $key
114
     * @param bool $valueOnly
115
     * @param mixed $defaultValue
116
     * @return ContentBlock|string
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use string.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
117
     */
118
    public static function getChunk($key, $valueOnly = true, $defaultValue = null)
0 ignored issues
show
Unused Code introduced by
The parameter $valueOnly is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $defaultValue is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
119
    {
120
        return ContentBlockHelper::getChunk($key);
121
    }
122
123
124
    /**
125
     * @return ContentBlockGroup[]
0 ignored issues
show
Documentation introduced by
Should the return type not be \yii\db\ActiveQuery?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
126
     */
127
    public function getGroup()
128
    {
129
        return $this->hasOne(ContentBlockGroup::className(), ['id' => 'group_id']);
130
    }
131
}