TokenController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A behaviors() 0 8 1
A actionCreate() 0 6 1
1
<?php
2
3
namespace zacksleo\yii2\oauth2\api\controllers;
4
5
use zacksleo\yii2\oauth2\common\behaviors\TokenBehavior;
6
use zacksleo\yii2\oauth2\api\components\RestController;
7
use yii;
8
use yii\helpers\ArrayHelper;
9
10
class TokenController extends RestController
11
{
12
    public function behaviors()
13
    {
14
        return ArrayHelper::merge(parent::behaviors(), [
15
            'behaviors' => [
16
                'class' => TokenBehavior::className(),
0 ignored issues
show
Deprecated Code introduced by
The method yii\base\BaseObject::className() has been deprecated with message: since 2.0.14. On PHP >=5.5, use `::class` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
17
            ]
18
        ]);
19
    }
20
21
    public function actionCreate()
22
    {
23
        /** @var $response \OAuth2\Response */
24
        $response = Yii::$app->getModule('oauth2')->getServer()->handleTokenRequest();
25
        return $response->getParameters();
26
    }
27
}
28