Oauth2ClientScope   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 18
c 1
b 0
f 0
dl 0
loc 55
ccs 24
cts 24
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A find() 0 3 1
A attributeLabels() 0 10 1
A rules() 0 8 1
A getClient() 0 3 1
A getScope() 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_client_scope".
12
 *
13
 * @property integer $client_id
14
 * @property integer $scope_id
15
 * @property integer $applied_by_default
16
 * @property boolean $required_on_authorization
17
 * @property boolean $enabled
18
 * @property integer $created_at
19
 * @property integer $updated_at
20
 *
21
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2Client $client
22
 * @property \rhertogh\Yii2Oauth2Server\models\Oauth2Scope $scope
23
 * @property string $aliasModel
24
 *
25
 * phpcs:disable Generic.Files.LineLength.TooLong
26
 */
27
abstract class Oauth2ClientScope extends \rhertogh\Yii2Oauth2Server\models\base\Oauth2BaseActiveRecord
28
{
29
    /**
30
     * @inheritdoc
31
     */
32 1
    public function rules()
33
    {
34 1
        return [
35 1
            [['client_id', 'scope_id', 'created_at', 'updated_at'], 'required'],
36 1
            [['client_id', 'scope_id', 'applied_by_default', 'created_at', 'updated_at'], 'default', 'value' => null],
37 1
            [['client_id', 'scope_id', 'applied_by_default', 'created_at', 'updated_at'], 'integer'],
38 1
            [['required_on_authorization', 'enabled'], 'boolean'],
39 1
            [['client_id', 'scope_id'], 'unique', 'targetAttribute' => ['client_id', 'scope_id']]
40 1
        ];
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46 1
    public function attributeLabels()
47
    {
48 1
        return [
49 1
            'client_id' => Yii::t('oauth2', 'Client ID'),
50 1
            'scope_id' => Yii::t('oauth2', 'Scope ID'),
51 1
            'applied_by_default' => Yii::t('oauth2', 'Applied By Default'),
52 1
            'required_on_authorization' => Yii::t('oauth2', 'Required On Authorization'),
53 1
            'enabled' => Yii::t('oauth2', 'Enabled'),
54 1
            'created_at' => Yii::t('oauth2', 'Created At'),
55 1
            'updated_at' => Yii::t('oauth2', 'Updated At'),
56 1
        ];
57
    }
58
59
    /**
60
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ClientQueryInterface     */
61 1
    public function getClient()
62
    {
63 1
        return $this->hasOne(\rhertogh\Yii2Oauth2Server\models\Oauth2Client::class, ['id' => 'client_id'])->inverseOf('clientScopes');
64
    }
65
66
    /**
67
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ScopeQueryInterface     */
68 3
    public function getScope()
69
    {
70 3
        return $this->hasOne(\rhertogh\Yii2Oauth2Server\models\Oauth2Scope::class, ['id' => 'scope_id'])->inverseOf('clientScopes');
71
    }
72
73
74
75
    /**
76
     * @inheritdoc
77
     * @return \rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ClientScopeQueryInterface the active query used by this AR class.
78
     */
79 4
    public static function find()
80
    {
81 4
        return Yii::createObject(\rhertogh\Yii2Oauth2Server\interfaces\models\queries\Oauth2ClientScopeQueryInterface::class, [get_called_class()]);
82
    }
83
}
84