Passed
Push — master ( 36be2d...32b990 )
by Carlos
02:58
created

m140501_075316_oauth_public_keys::foreignKeys()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 1
b 1
f 0
1
<?php
2
3
use roaresearch\yii2\oauth2server\migrations\tables\CreateTable;
4
5
class m140501_075316_oauth_public_keys extends CreateTable
6
{
7
    /**
8
     * @inheritdoc
9
     */
10
    public function getTableName(): string
11
    {
12
        return 'oauth_public_keys';
13
    }
14
15
    /**
16
     * @inheritdoc
17
     */
18
    public function columns(): array
19
    {
20
        return [
21
            'client_id' => $this->string(32)->notNull(),
22
            'public_key' => $this->string(200)->notNUll(),
23
            'private_key' => $this->string(200)->notNUll(),
24
            'encription_algorithm' => $this->string(100)->notNull()
25
                ->defaultValue('RS256'),
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
    /**
43
     * @inheritdoc
44
     */
45
    public function compositePrimaryKeys(): array
46
    {
47
        return ['client_id', 'public_key'];
48
    }
49
}
50