Oauth2Scope   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 101
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 11
eloc 28
c 1
b 0
f 0
dl 0
loc 101
ccs 40
cts 40
cp 1
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A find() 0 3 1
A getAuthCodes() 0 3 1
A getAuthCodeScopes() 0 3 1
A getUserClientScopes() 0 3 1
A getClients() 0 3 1
A getUserClients() 0 3 1
A getClientScopes() 0 3 1
A rules() 0 10 1
A getAccessTokenScopes() 0 3 1
A getAccessTokens() 0 3 1
A attributeLabels() 0 12 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_scope".
12
 *
13
 * @property integer $id
14
 * @property string $identifier
15
 * @property string $description
16
 * @property string $authorization_message
17
 * @property integer $applied_by_default
18
 * @property boolean $required_on_authorization
19
 * @property boolean $enabled
20
 * @property integer $created_at
21
 * @property integer $updated_at
22
 *
23
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2AccessTokenScope[] $accessTokenScopes
24
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2AccessToken[] $accessTokens
25
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2AuthCodeScope[] $authCodeScopes
26
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2AuthCode[] $authCodes
27
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2ClientScope[] $clientScopes
28
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2Client[] $clients
29
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2UserClientScope[] $userClientScopes
30
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2UserClient[] $userClients
31
 * @property string $aliasModel
32
 *
33
 * phpcs:disable Generic.Files.LineLength.TooLong
34
 */
35
abstract class Oauth2Scope extends \rhertogh\Yii2Oauth2Server\models\base\Oauth2BaseActiveRecord
36
{
37
    /**
38
     * @inheritdoc
39
     */
40 1
    public function rules()
41
    {
42 1
        return [
43 1
            [['identifier', 'created_at', 'updated_at'], 'required'],
44 1
            [['description', 'authorization_message'], 'string'],
45 1
            [['applied_by_default', 'created_at', 'updated_at'], 'default', 'value' => null],
46 1
            [['applied_by_default', 'created_at', 'updated_at'], 'integer'],
47 1
            [['required_on_authorization', 'enabled'], 'boolean'],
48 1
            [['identifier'], 'string', 'max' => 255],
49 1
            [['identifier'], 'unique']
50 1
        ];
51
    }
52
53
    /**
54
     * @inheritdoc
55
     */
56 1
    public function attributeLabels()
57
    {
58 1
        return [
59 1
            'id' => Yii::t('oauth2', 'ID'),
60 1
            'identifier' => Yii::t('oauth2', 'Identifier'),
61 1
            'description' => Yii::t('oauth2', 'Description'),
62 1
            'authorization_message' => Yii::t('oauth2', 'Authorization Message'),
63 1
            'applied_by_default' => Yii::t('oauth2', 'Applied By Default'),
64 1
            'required_on_authorization' => Yii::t('oauth2', 'Required On Authorization'),
65 1
            'enabled' => Yii::t('oauth2', 'Enabled'),
66 1
            'created_at' => Yii::t('oauth2', 'Created At'),
67 1
            'updated_at' => Yii::t('oauth2', 'Updated At'),
68 1
        ];
69
    }
70
71
    /**
72
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2AccessTokenScopeQueryInterface     */
73 2
    public function getAccessTokenScopes()
74
    {
75 2
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2AccessTokenScope::class, ['scope_id' => 'id'])->inverseOf('scope');
76
    }
77
78
    /**
79
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2AccessTokenQueryInterface     */
80 1
    public function getAccessTokens()
81
    {
82 1
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2AccessToken::class, ['id' => 'access_token_id'])->via('accessTokenScopes');
83
    }
84
85
    /**
86
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2AuthCodeScopeQueryInterface     */
87 2
    public function getAuthCodeScopes()
88
    {
89 2
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2AuthCodeScope::class, ['scope_id' => 'id'])->inverseOf('scope');
90
    }
91
92
    /**
93
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2AuthCodeQueryInterface     */
94 1
    public function getAuthCodes()
95
    {
96 1
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2AuthCode::class, ['id' => 'auth_code_id'])->via('authCodeScopes');
97
    }
98
99
    /**
100
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ClientScopeQueryInterface     */
101 6
    public function getClientScopes()
102
    {
103 6
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2ClientScope::class, ['scope_id' => 'id'])->inverseOf('scope');
104
    }
105
106
    /**
107
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ClientQueryInterface     */
108 1
    public function getClients()
109
    {
110 1
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2Client::class, ['id' => 'client_id'])->via('clientScopes');
111
    }
112
113
    /**
114
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2UserClientScopeQueryInterface     */
115 2
    public function getUserClientScopes()
116
    {
117 2
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2UserClientScope::class, ['scope_id' => 'id'])->inverseOf('scope');
118
    }
119
120
    /**
121
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2UserClientQueryInterface     */
122 1
    public function getUserClients()
123
    {
124 1
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2UserClient::class, ['user_id' => 'user_id', 'client_id' => 'client_id'])->via('userClientScopes');
125
    }
126
127
128
129
    /**
130
     * @inheritdoc
131
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ScopeQueryInterface the active query used by this AR class.
132
     */
133 9
    public static function find()
134
    {
135 9
        return Yii::createObject(\rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ScopeQueryInterface::class, [get_called_class()]);
136
    }
137
}
138