m140501_075314_oauth_authorization_codes   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A foreignKeys() 0 6 1
A getTableName() 0 3 1
A columns() 0 9 1
1
<?php
2
3
use roaresearch\yii2\oauth2server\migrations\tables\CreateTable;
4
5
class m140501_075314_oauth_authorization_codes extends CreateTable
6
{
7
    /**
8
     * @inheritdoc
9
     */
10
    public function getTableName(): string
11
    {
12
        return 'oauth_authorization_codes';
13
    }
14
15
    /**
16
     * @inheritdoc
17
     */
18
    public function columns(): array
19
    {
20
        return [
21
            'authorization_code' => $this->primaryKey(40),
22
            'client_id' => $this->string(32)->notNull(),
23
            'user_id' => $this->normalKey()->null()->defaultValue(null),
24
            'redirect_uri' => $this->string(1000)->notNull(),
25
            'expires' => $this->datetime()->notNull(),
26
            'scope' => $this->string(2000)->notNull()->defaultValue(null),
27
        ];
28
    }
29
30
    /**
31
     * @inheritdoc
32
     */
33
    public function foreignKeys(): array
34
    {
35
        return [
36
            'client_id' => [
37
                'table' => 'oauth_clients',
38
                'columns' => ['client_id' => 'client_id'],
39
            ],
40
        ];
41
    }
42
}
43