| Total Complexity | 2 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | class RestApiController extends BaseController |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * Call specific method depending on request method |
||
| 29 | * |
||
| 30 | * @return array|null |
||
| 31 | */ |
||
| 32 | 10 | public function index(): ?array |
|
| 33 | { |
||
| 34 | 10 | $method = strtolower($_SERVER['REQUEST_METHOD']); |
|
| 35 | |||
| 36 | 10 | return $this->$method(); |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * For not defined methods return 405 response |
||
| 41 | * |
||
| 42 | * @param $name |
||
| 43 | * @param $arguments |
||
| 44 | * |
||
| 45 | * @throws NotAllowedException |
||
| 46 | */ |
||
| 47 | 6 | public function __call($name, $arguments) |
|
| 50 | } |
||
| 51 | } |
||
| 52 |