Completed
Push — master ( 10f95b...bf15d4 )
by Michael
09:02
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 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 25
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 15 1
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
 * @since          1.0
20
 */
21
class SubmitControllerGet extends AbstractController
22
{
23
	/**
24
	 * Execute the controller.
25
	 *
26
	 * @return  boolean
27
	 *
28
	 * @since   1.0
29
	 */
30 1
	public function execute()
31
	{
32
		$response = [
33 1
			'error'   => true,
34
			'message' => 'This route only accepts POST requests.'
35
		];
36
37
		// Set the response headers to indicate the method is not allowed
38 1
		$this->getApplication()->setHeader('HTTP/1.1 405 Method Not Allowed', 405, true);
39 1
		$this->getApplication()->setHeader('Allow', 'POST');
40
41 1
		$this->getApplication()->setBody(json_encode($response));
42
43 1
		return true;
44
	}
45
}
46