Completed
Push — mysql_improvements ( 2e95ce...dedbef )
by Michael
03:52
created

SubmitControllerGet   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 1
c 3
b 0
f 1
lcom 0
cbo 2
dl 0
loc 25
ccs 7
cts 7
cp 1
rs 10
1
<?php
2
/**
3
 * Joomla! Statistics Server
4
 *
5
 * @copyright  Copyright (C) 2013 - 2017 Open Source Matters, Inc. All rights reserved.
6
 * @license    http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License Version 2 or Later
7
 */
8
9
namespace Joomla\StatsServer\Controllers;
10
11
use Joomla\Controller\AbstractController;
12
13
/**
14
 * Controller for processing submitted statistics data.
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
	}
41
}
42