Conditions | 1 |
Paths | 1 |
Total Lines | 27 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function behaviors() |
||
20 | { |
||
21 | $behaviors = ArrayHelper::merge(parent::behaviors(), [ |
||
22 | 'exceptionFilter' => [ |
||
23 | 'class' => ErrorToExceptionFilter::className() |
||
24 | ], |
||
25 | [ |
||
26 | 'class' => ContentNegotiator::className(), |
||
27 | 'formats' => [ |
||
28 | 'application/json' => Response::FORMAT_JSON, |
||
29 | ], |
||
30 | 'languages' => [ |
||
31 | 'zh-CN', |
||
32 | 'zh-TW', |
||
33 | 'en-US', |
||
34 | ], |
||
35 | ], |
||
36 | ]); |
||
37 | $auth = $behaviors['authenticator']; |
||
38 | unset($behaviors['authenticator']); |
||
39 | $behaviors['corsFilter'] = [ |
||
40 | 'class' => \yii\filters\Cors::className(), |
||
41 | ]; |
||
42 | $behaviors['authenticator'] = $auth; |
||
43 | $behaviors['authenticator']['except'] = ['options']; |
||
44 | return $behaviors; |
||
45 | } |
||
46 | |||
59 |