Oauth2AuthCode   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 23
c 1
b 0
f 0
dl 0
loc 66
ccs 30
cts 30
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A attributeLabels() 0 12 1
A find() 0 3 1
A rules() 0 10 1
A getClient() 0 3 1
A getScopes() 0 3 1
A getAuthCodeScopes() 0 3 1
1
<?php
2
3
// This class was automatically generated by a giiant build task.
4
// You should not change it manually as it will be overwritten on next build.
5
6
namespace rhertogh\Yii2Oauth2Server\models\base;
7
8
use Yii;
9
10
/**
11
 * This is the base-model class for table "oauth2_auth_code".
12
 *
13
 * @property integer $id
14
 * @property string $identifier
15
 * @property string $redirect_uri
16
 * @property string $expiry_date_time
17
 * @property integer $client_id
18
 * @property integer $user_id
19
 * @property boolean $enabled
20
 * @property integer $created_at
21
 * @property integer $updated_at
22
 *
23
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2AuthCodeScope[] $authCodeScopes
24
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2Client $client
25
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2Scope[] $scopes
26
 * @property string $aliasModel
27
 *
28
 * phpcs:disable Generic.Files.LineLength.TooLong
29
 */
30
abstract class Oauth2AuthCode extends \rhertogh\Yii2Oauth2Server\models\base\Oauth2BaseActiveRecord
31
{
32
    /**
33
     * @inheritdoc
34
     */
35 1
    public function rules()
36
    {
37 1
        return [
38 1
            [['identifier', 'expiry_date_time', 'client_id', 'user_id', 'created_at', 'updated_at'], 'required'],
39 1
            [['expiry_date_time'], 'safe'],
40 1
            [['client_id', 'user_id', 'created_at', 'updated_at'], 'default', 'value' => null],
41 1
            [['client_id', 'user_id', 'created_at', 'updated_at'], 'integer'],
42 1
            [['enabled'], 'boolean'],
43 1
            [['identifier', 'redirect_uri'], 'string', 'max' => 255],
44 1
            [['identifier'], 'unique']
45 1
        ];
46
    }
47
48
    /**
49
     * @inheritdoc
50
     */
51 1
    public function attributeLabels()
52
    {
53 1
        return [
54 1
            'id' => Yii::t('oauth2', 'ID'),
55 1
            'identifier' => Yii::t('oauth2', 'Identifier'),
56 1
            'redirect_uri' => Yii::t('oauth2', 'Redirect Uri'),
57 1
            'expiry_date_time' => Yii::t('oauth2', 'Expiry Date Time'),
58 1
            'client_id' => Yii::t('oauth2', 'Client ID'),
59 1
            'user_id' => Yii::t('oauth2', 'User ID'),
60 1
            'enabled' => Yii::t('oauth2', 'Enabled'),
61 1
            'created_at' => Yii::t('oauth2', 'Created At'),
62 1
            'updated_at' => Yii::t('oauth2', 'Updated At'),
63 1
        ];
64
    }
65
66
    /**
67
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2AuthCodeScopeQueryInterface     */
68 4
    public function getAuthCodeScopes()
69
    {
70 4
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2AuthCodeScope::class, ['auth_code_id' => 'id'])->inverseOf('authCode');
71
    }
72
73
    /**
74
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ClientQueryInterface     */
75 4
    public function getClient()
76
    {
77 4
        return $this->hasOne(\rhertogh\Yii2Oauth2Server\models\Oauth2Client::class, ['id' => 'client_id'])->inverseOf('authCodes');
78
    }
79
80
    /**
81
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ScopeQueryInterface     */
82 4
    public function getScopes()
83
    {
84 4
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2Scope::class, ['id' => 'scope_id'])->via('authCodeScopes');
85
    }
86
87
88
89
    /**
90
     * @inheritdoc
91
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2AuthCodeQueryInterface the active query used by this AR class.
92
     */
93 5
    public static function find()
94
    {
95 5
        return Yii::createObject(\rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2AuthCodeQueryInterface::class, [get_called_class()]);
96
    }
97
}
98