Completed
Push — develop ( 112c74...31322a )
by Nate
10:28
created

RouteController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 30
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A actionIndex() 0 16 1
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/jwt/license
6
 * @link       https://www.flipboxfactory.com/jwt/organization/
7
 */
8
9
namespace flipbox\craft\jwt\controllers;
10
11
use Craft;
12
use flipbox\craft\jwt\actions\RouteAction;
13
use craft\web\Controller;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.2.0
18
 */
19
class RouteController extends Controller
20
{
21
    /**
22
     * @inheritdoc
23
     */
24
    protected $allowAnonymous = ['index'];
25
26
    /**
27
     * @param string|null $jwt
28
     * @return mixed
29
     * @throws \yii\base\InvalidConfigException
30
     * @throws \yii\web\BadRequestHttpException
31
     */
32
    public function actionIndex(string $jwt = null)
33
    {
34
        $jwt = $jwt ?? Craft::$app->getRequest()->getRequiredParam('jwt');
35
36
        /** @var RouteAction $action */
37
        $action = Craft::createObject([
38
            'class' => RouteAction::class
39
        ], [
40
            'index',
41
            $this
42
        ]);
43
44
        return $action->runWithParams([
45
            'token' => $jwt
46
        ]);
47
    }
48
}
49