1 | <?php |
||
15 | * |
||
16 | * @method \Joomla\StatsServer\WebApplication getApplication() Get the application object. |
||
17 | * @property-read \Joomla\StatsServer\WebApplication $app Application object |
||
18 | */ |
||
19 | class SubmitControllerGet extends AbstractController |
||
20 | { |
||
21 | /** |
||
22 | * Execute the controller. |
||
23 | * |
||
24 | * @return boolean |
||
25 | */ |
||
26 | 1 | public function execute() |
|
27 | { |
||
28 | $response = [ |
||
29 | 1 | 'error' => true, |
|
30 | 'message' => 'This route only accepts POST requests.' |
||
31 | ]; |
||
32 | |||
33 | // Set the response headers to indicate the method is not allowed |
||
34 | 1 | $this->getApplication()->setHeader('HTTP/1.1 405 Method Not Allowed', 405, true); |
|
35 | 1 | $this->getApplication()->setHeader('Allow', 'POST'); |
|
36 | |||
37 | 1 | $this->getApplication()->setBody(json_encode($response)); |
|
38 | |||
39 | 1 | return true; |
|
40 | } |
||
42 |