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

Controller   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A behaviors() 0 7 1
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
}