Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function run($id = null, array $args = []) |
||
28 | { |
||
29 | $method = strtolower(Yii::$app->request->method); |
||
30 | |||
31 | // Make sure the method exists before trying to call it |
||
32 | if (method_exists(get_called_class(), $method)) { |
||
33 | return $this->$method(\array_merge(['id' => $id], $args)); |
||
34 | } |
||
35 | |||
36 | // Return a 405 if the method isn't implemented |
||
37 | // When coupled with RestController, this should _never_ get called |
||
38 | // But this is the correct response if for some reason it isn't |
||
39 | throw new HttpException(405); |
||
40 | } |
||
53 |