Passed
Branch master (9b4352)
by Rutger
13:03
created

Oauth2EncryptionController::actions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace rhertogh\Yii2Oauth2Server\controllers\console;
4
5
use rhertogh\Yii2Oauth2Server\controllers\console\base\Oauth2BaseConsoleController;
6
use rhertogh\Yii2Oauth2Server\controllers\console\encryption\Oauth2EncryptionKeyUsageAction;
7
use rhertogh\Yii2Oauth2Server\controllers\console\encryption\Oauth2RotateEncryptionKeysAction;
8
use yii\helpers\ArrayHelper;
9
10
class Oauth2EncryptionController extends Oauth2BaseConsoleController
11
{
12
    /**
13
     * @var string|null
14
     */
15
    public $keyName = null;
16
17
    /**
18
     * @inheritDoc
19
     */
20
    public function options($actionID)
21
    {
22
        if (in_array($actionID, ['key-usage', 'rotate-keys'])) {
23
            $options = [
24
                'keyName',
25
            ];
26
        }
27
        return ArrayHelper::merge(parent::options($actionID), $options ?? []);
28
    }
29
30
    public function optionAliases()
31
    {
32
        return ArrayHelper::merge(parent::optionAliases(), [
33
            'k' => 'keyName',
34
        ]);
35
    }
36
37
    /**
38
     * @inheritDoc
39
     */
40
    public function actions()
41
    {
42
        return [
43
            'key-usage' => Oauth2EncryptionKeyUsageAction::class,
44
            'rotate-keys' => Oauth2RotateEncryptionKeysAction::class,
45
        ];
46
    }
47
}
48