Conditions | 3 |
Paths | 4 |
Total Lines | 9 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
36 | public function run($id = null) |
||
37 | { |
||
38 | if (Yii::$app->getRequest()->getMethod() !== 'OPTIONS') { |
||
|
|||
39 | Yii::$app->getResponse()->setStatusCode(405); |
||
40 | } |
||
41 | $options = $id === null ? $this->collectionOptions : $this->resourceOptions; |
||
42 | $headers = Yii::$app->getResponse()->getHeaders(); |
||
43 | $headers->set('Allow', implode(', ', $options)); |
||
44 | $headers->set('Access-Control-Allow-Methods', implode(', ', $options)); |
||
45 | } |
||
47 |