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

m140501_075316_oauth_public_keys   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 13
dl 0
loc 43
rs 10
c 1
b 1
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getTableName() 0 3 1
A foreignKeys() 0 6 1
A compositePrimaryKeys() 0 3 1
A columns() 0 8 1
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