Oauth2Client::getAccessTokens()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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_client".
12
 *
13
 * @property integer $id
14
 * @property string $identifier
15
 * @property string $name
16
 * @property integer $type
17
 * @property string $secret
18
 * @property string $old_secret
19
 * @property string $old_secret_valid_until
20
 * @property array $env_var_config
21
 * @property string $logo_uri
22
 * @property string $tos_uri
23
 * @property array $contacts
24
 * @property array $redirect_uris
25
 * @property array $post_logout_redirect_uris
26
 * @property boolean $allow_variable_redirect_uri_query
27
 * @property integer $token_types
28
 * @property integer $grant_types
29
 * @property boolean $allow_generic_scopes
30
 * @property boolean $exception_on_invalid_scope
31
 * @property boolean $end_users_may_authorize_client
32
 * @property integer $user_account_selection
33
 * @property boolean $allow_auth_code_without_pkce
34
 * @property boolean $skip_authorization_if_scope_is_allowed
35
 * @property integer $client_credentials_grant_user_id
36
 * @property boolean $oidc_allow_offline_access_without_consent
37
 * @property integer $oidc_rp_initiated_logout
38
 * @property string $oidc_userinfo_encrypted_response_alg
39
 * @property boolean $enabled
40
 * @property integer $created_at
41
 * @property integer $updated_at
42
 *
43
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2AccessToken[] $accessTokens
44
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2AuthCode[] $authCodes
45
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2ClientScope[] $clientScopes
46
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2Scope[] $scopes
47
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2UserClient[] $userClients
48
 * @property string $aliasModel
49
 *
50
 * phpcs:disable Generic.Files.LineLength.TooLong
51
 */
52
abstract class Oauth2Client extends \rhertogh\Yii2Oauth2Server\models\base\Oauth2BaseActiveRecord
53
{
54
    /**
55
     * @inheritdoc
56
     */
57 2
    public function rules()
58
    {
59 2
        return [
60 2
            [['identifier', 'name', 'created_at', 'updated_at'], 'required'],
61 2
            [['type', 'token_types', 'grant_types', 'user_account_selection', 'client_credentials_grant_user_id', 'oidc_rp_initiated_logout', 'created_at', 'updated_at'], 'default', 'value' => null],
62 2
            [['type', 'token_types', 'grant_types', 'user_account_selection', 'client_credentials_grant_user_id', 'oidc_rp_initiated_logout', 'created_at', 'updated_at'], 'integer'],
63 2
            [['secret', 'old_secret'], 'string'],
64 2
            [['old_secret_valid_until', 'env_var_config', 'contacts', 'redirect_uris', 'post_logout_redirect_uris'], 'safe'],
65 2
            [['allow_variable_redirect_uri_query', 'allow_generic_scopes', 'exception_on_invalid_scope', 'end_users_may_authorize_client', 'allow_auth_code_without_pkce', 'skip_authorization_if_scope_is_allowed', 'oidc_allow_offline_access_without_consent', 'enabled'], 'boolean'],
66 2
            [['identifier', 'name', 'logo_uri', 'tos_uri', 'oidc_userinfo_encrypted_response_alg'], 'string', 'max' => 255],
67 2
            [['identifier'], 'unique']
68 2
        ];
69
    }
70
71
    /**
72
     * @inheritdoc
73
     */
74 1
    public function attributeLabels()
75
    {
76 1
        return [
77 1
            'id' => Yii::t('oauth2', 'ID'),
78 1
            'identifier' => Yii::t('oauth2', 'Identifier'),
79 1
            'name' => Yii::t('oauth2', 'Name'),
80 1
            'type' => Yii::t('oauth2', 'Type'),
81 1
            'secret' => Yii::t('oauth2', 'Secret'),
82 1
            'old_secret' => Yii::t('oauth2', 'Old Secret'),
83 1
            'old_secret_valid_until' => Yii::t('oauth2', 'Old Secret Valid Until'),
84 1
            'env_var_config' => Yii::t('oauth2', 'Env Var Config'),
85 1
            'logo_uri' => Yii::t('oauth2', 'Logo Uri'),
86 1
            'tos_uri' => Yii::t('oauth2', 'Tos Uri'),
87 1
            'contacts' => Yii::t('oauth2', 'Contacts'),
88 1
            'redirect_uris' => Yii::t('oauth2', 'Redirect Uris'),
89 1
            'post_logout_redirect_uris' => Yii::t('oauth2', 'Post Logout Redirect Uris'),
90 1
            'allow_variable_redirect_uri_query' => Yii::t('oauth2', 'Allow Variable Redirect Uri Query'),
91 1
            'token_types' => Yii::t('oauth2', 'Token Types'),
92 1
            'grant_types' => Yii::t('oauth2', 'Grant Types'),
93 1
            'allow_generic_scopes' => Yii::t('oauth2', 'Allow Generic Scopes'),
94 1
            'exception_on_invalid_scope' => Yii::t('oauth2', 'Exception On Invalid Scope'),
95 1
            'end_users_may_authorize_client' => Yii::t('oauth2', 'End Users May Authorize Client'),
96 1
            'user_account_selection' => Yii::t('oauth2', 'User Account Selection'),
97 1
            'allow_auth_code_without_pkce' => Yii::t('oauth2', 'Allow Auth Code Without Pkce'),
98 1
            'skip_authorization_if_scope_is_allowed' => Yii::t('oauth2', 'Skip Authorization If Scope Is Allowed'),
99 1
            'client_credentials_grant_user_id' => Yii::t('oauth2', 'Client Credentials Grant User ID'),
100 1
            'oidc_allow_offline_access_without_consent' => Yii::t('oauth2', 'Oidc Allow Offline Access Without Consent'),
101 1
            'oidc_rp_initiated_logout' => Yii::t('oauth2', 'Oidc Rp Initiated Logout'),
102 1
            'oidc_userinfo_encrypted_response_alg' => Yii::t('oauth2', 'Oidc Userinfo Encrypted Response Alg'),
103 1
            'enabled' => Yii::t('oauth2', 'Enabled'),
104 1
            'created_at' => Yii::t('oauth2', 'Created At'),
105 1
            'updated_at' => Yii::t('oauth2', 'Updated At'),
106 1
        ];
107
    }
108
109
    /**
110
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2AccessTokenQueryInterface     */
111 1
    public function getAccessTokens()
112
    {
113 1
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2AccessToken::class, ['client_id' => 'id'])->inverseOf('client');
114
    }
115
116
    /**
117
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2AuthCodeQueryInterface     */
118 1
    public function getAuthCodes()
119
    {
120 1
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2AuthCode::class, ['client_id' => 'id'])->inverseOf('client');
121
    }
122
123
    /**
124
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ClientScopeQueryInterface     */
125 3
    public function getClientScopes()
126
    {
127 3
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2ClientScope::class, ['client_id' => 'id'])->inverseOf('client');
128
    }
129
130
    /**
131
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ScopeQueryInterface     */
132 1
    public function getScopes()
133
    {
134 1
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2Scope::class, ['id' => 'scope_id'])->via('clientScopes');
135
    }
136
137
    /**
138
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2UserClientQueryInterface     */
139 1
    public function getUserClients()
140
    {
141 1
        return $this->hasMany(\rhertogh\Yii2Oauth2Server\models\Oauth2UserClient::class, ['client_id' => 'id'])->inverseOf('client');
142
    }
143
144
145
146
    /**
147
     * @inheritdoc
148
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ClientQueryInterface the active query used by this AR class.
149
     */
150 16
    public static function find()
151
    {
152 16
        return Yii::createObject(\rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ClientQueryInterface::class, [get_called_class()]);
153
    }
154
}
155