Passed
Push — master ( 42aa49...a46232 )
by Anton
04:55
created

Controller::behaviors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Anton Tuyakhov <[email protected]>
4
 */
5
6
namespace tuyakhov\jsonapi;
7
8
9
use yii\filters\ContentNegotiator;
10
use yii\helpers\ArrayHelper;
11
use yii\web\Response;
12
13
class Controller extends \yii\rest\Controller
14
{
15
    public $serializer = 'tuyakhov\jsonapi\Serializer';
16
17
    /**
18
     * @inheritdoc
19
     */
20
    public function behaviors()
21
    {
22
        return ArrayHelper::merge(parent::behaviors(), [
23
            'contentNegotiator' => [
24
                'class' => ContentNegotiator::className(),
25
                'formats' => [
26
                    'application/vnd.api+json' => Response::FORMAT_JSON,
27
                ],
28
            ]
29
        ]);
30
    }
31
32
}