LogoutController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 1
cbo 2
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handleRequest() 0 6 2
1
<?php
2
/**
3
 * Logout controller class.
4
 *
5
 * @version 1.2.0
6
 * @since 1.2.0
7
 */
8
9
namespace Cassava\CAS\Controller;
10
11
use Cassava\CAS;
12
13
/**
14
 * Implements CAS logout.
15
 *
16
 * `/logout` destroys a client's single sign-on CAS session.
17
 *
18
 * When called, this method will destroy the ticket-granting cookie and prevent subsequent
19
 * requests to `/login` from returning service tickets until the user re-authenticates using
20
 * their primary credentials.
21
 *
22
 * The following HTTP request parameter may be specified:
23
 *
24
 * - `url` (optional): If specified, the server will redirect the user to the page located at
25
 *   `url`, which should contain a description telling the user they've been logged out.
26
 *
27
 * @since 1.2.0
28
 */
29
class LogoutController extends BaseController {
30
31
	/**
32
	 * Handles logout requests.
33
	 *
34
	 * @param array $request CAS request arguments.
35
	 *
36
	 * @uses \home_url()
37
	 */
38
	public function handleRequest( $request ) {
39
		$service = ! empty( $request['service'] ) ? $request['service'] : \home_url();
40
		$this->server->sessionStart();
41
		$this->server->sessionDestroy();
42
		$this->server->redirect( $service );
43
	}
44
}
45