Logout::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 25

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 25
c 0
b 0
f 0
ccs 11
cts 11
cp 1
rs 9.52
cc 2
nc 2
nop 0
crap 2
1
<?php
2
namespace Redaxscript\Controller;
3
4
use Redaxscript\Auth;
5
6
/**
7
 * children class to process the logout request
8
 *
9
 * @since 3.0.0
10
 *
11
 * @package Redaxscript
12
 * @category Controller
13
 * @author Henry Ruhs
14
 * @author Balázs Szilágyi
15
 */
16
17
class Logout extends ControllerAbstract
18
{
19
	/**
20
	 * process the class
21
	 *
22
	 * @since 3.0.0
23
	 *
24
	 * @return string
25
	 */
26
27 2
	public function process() : string
28
	{
29 2
		$auth = new Auth($this->_request);
30 2
		$auth->init();
31
32
		/* handle logout */
33
34 2
		if ($auth->logout())
35
		{
36 1
			return $this->_success(
37
			[
38 1
				'route' => 'login',
39 1
				'timeout' => 0,
40 1
				'message' => $this->_language->get('logged_out'),
41 1
				'title' => $this->_language->get('goodbye')
42
			]);
43
		}
44
45
		/* handle error */
46
47 1
		return $this->_error(
48
		[
49 1
			'route' => 'login'
50
		]);
51
	}
52
}
53