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.
Passed
Push — filters-dev ( b32603 )
by
unknown
11:53
created

Meta::tableName()   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 0
1
<?php
2
3
namespace app\modules\seo\models;
4
5
use app\backend\BackendModule;
6
use app\backend\components\BackendController;
7
use devgroup\TagDependencyHelper\ActiveRecordHelper;
8
use Yii;
9
use yii\data\ActiveDataProvider;
10
use yii\db\ActiveRecord;
11
12
/**
13
 * This is the model class for table "seo_meta".
14
 *
15
 * @property string $key
16
 * @property string $name
17
 * @property integer $content
18
 */
19
class Meta extends ActiveRecord
20
{
21
    /**
22
     * @inheritdoc
23
     */
24
    public static function tableName()
25
    {
26
        return '{{%seo_meta}}';
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function behaviors()
33
    {
34
        return [
35
            'class' => ActiveRecordHelper::className(),
36
        ];
37
    }
38
39
    /**
40
     * @inheritdoc
41
     */
42
    public function rules()
43
    {
44
        return [
45
            [['key', 'name', 'content'], 'required'],
46
            [['key'], 'unique'],
47
            [['key', 'name', 'content'], 'string', 'max' => 255]
48
        ];
49
    }
50
51
    /**
52
     * @inheritdoc
53
     */
54
    public function attributeLabels()
55
    {
56
        return [
57
            'key' => \Yii::t('app', 'Key'),
58
            'name' => \Yii::t('app', 'Name'),
59
            'content' => \Yii::t('app', 'Content'),
60
        ];
61
    }
62
63
    /**
64
     * Search meta tags
65
     * @param $params
66
     * @return ActiveDataProvider
67
     */
68
    public function search($params)
69
    {
70
        $this->load($params);
71
        $query = self::find();
72
        foreach ($this->attributes as $name => $value) {
73
            if (!empty($value)) {
74
                $query->andWhere("`$name` LIKE :$name", [":$name" => "%$value%"]);
75
            }
76
        }
77
        $dataProvider = new ActiveDataProvider(
78
            [
79
                'query' => $query,
80
                'pagination' => [
81
                    'pageSize' => 10,
82
                ],
83
            ]
84
        );
85
        return $dataProvider;
86
    }
87
88
    public static function registrationMeta()
89
    {
90
        if (Yii::$app->request->isAjax === false && !BackendModule::isBackend()) {
91
            $cacheName = Yii::$app->getModule('seo')->cacheConfig['metaCache']['name'];
92
            $cacheExpire = Yii::$app->getModule('seo')->cacheConfig['metaCache']['expire'];
93
            $metas = Yii::$app->getCache()->get($cacheName);
94
            if ($metas === false) {
95
                $metas = Meta::find()->all();
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
96
                Yii::$app->getCache()->set($cacheName, $metas, $cacheExpire);
97
            }
98
            foreach ($metas as $meta) {
99
                Yii::$app->controller->getView()->registerMetaTag(
100
                    [
101
                        'name' => $meta->name,
102
                        'content' => $meta->content,
103
                    ],
104
                    $meta->key
105
                );
106
            }
107
        }
108
    }
109
}
110