m140501_075312_oauth_access_tokens   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

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