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.

OrderChat::attributeLabels()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace app\backend\models;
4
5
use app\modules\user\models\User;
6
use Yii;
7
use yii\db\ActiveRecord;
8
9
/**
10
 * This is the model class for table "order_chat".
11
 *
12
 * @property string $id
13
 * @property string $order_id
14
 * @property string $user_id
15
 * @property string $date
16
 * @property string $message
17
 * Relations:
18
 * @property User $user
19
 */
20
class OrderChat extends ActiveRecord
21
{
22
    /**
23
     * @inheritdoc
24
     */
25
    public static function tableName()
26
    {
27
        return '{{%order_chat}}';
28
    }
29
30
    /**
31
     * @inheritdoc
32
     */
33
    public function rules()
34
    {
35
        return [
36
            [['order_id', 'user_id', 'message'], 'required'],
37
            [['order_id', 'user_id'], 'integer'],
38
            [['date'], 'safe'],
39
            [['message'], 'string'],
40
            [['user_id'], 'default', 'value' => \Yii::$app->user->id],
41
        ];
42
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47
    public function attributeLabels()
48
    {
49
        return [
50
            'id' => Yii::t('app', 'ID'),
51
            'order_id' => Yii::t('app', 'Order ID'),
52
            'user_id' => Yii::t('app', 'User ID'),
53
            'date' => Yii::t('app', 'Date'),
54
            'message' => Yii::t('app', 'Message'),
55
        ];
56
    }
57
58
    /**
59
     * @return User
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...
60
     */
61
    public function getUser()
62
    {
63
        return $this->hasOne(User::className(), ['id' => 'user_id']);
0 ignored issues
show
Deprecated Code introduced by
The method yii\base\BaseObject::className() has been deprecated with message: since 2.0.14. On PHP >=5.5, use `::class` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
64
    }
65
66
    public function beforeSave($insert)
67
    {
68
        if (false === parent::beforeSave($insert)) {
69
            return false;
70
        }
71
72
        if (empty($this->message)) {
0 ignored issues
show
Unused Code introduced by
This if statement, and the following return statement can be replaced with return !empty($this->message);.
Loading history...
73
            return false;
74
        }
75
76
        return true;
77
    }
78
}
79
?>