Oauth2BaseApiController::behaviors()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 10
ccs 9
cts 9
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace rhertogh\Yii2Oauth2Server\controllers\web\base;
4
5
use yii\filters\ContentNegotiator;
6
use yii\filters\Cors;
7
use yii\web\Response;
8
9
abstract class Oauth2BaseApiController extends Oauth2BaseWebController
10
{
11
    /**
12
     * @inheritDoc
13
     */
14
    public $enableCsrfValidation = false;
15
16
    /**
17
     * @inheritDoc
18
     */
19 6
    public function behaviors()
20
    {
21 6
        return [
22 6
            'cors' => [
23 6
                'class' => Cors::class,
24 6
            ],
25 6
            'contentNegotiator' => [
26 6
                'class' => ContentNegotiator::class,
27 6
                'formats' => [
28 6
                    'application/json' => Response::FORMAT_JSON,
29 6
                ],
30 6
            ],
31 6
        ];
32
    }
33
}
34