Completed
Push — master ( ec2c00...c3f83b )
by Markus
05:40
created

Default_LogoutAction   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 2
1
<?php
2
3
// +---------------------------------------------------------------------------+
4
// | This file is part of the Agavi package.                                   |
5
// | Copyright (c) 2005-2011 the Agavi Project.                                |
6
// |                                                                           |
7
// | For the full copyright and license information, please view the LICENSE   |
8
// | file that was distributed with this source code. You can also view the    |
9
// | LICENSE file online at http://www.agavi.org/LICENSE.txt                   |
10
// |   vi: set noexpandtab:                                                    |
11
// |   Local Variables:                                                        |
12
// |   indent-tabs-mode: t                                                     |
13
// |   End:                                                                    |
14
// +---------------------------------------------------------------------------+
15
use Agavi\Request\RequestDataHolder;
16
17
class Default_LogoutAction extends SampleAppDefaultBaseAction
18
{
19
	/**
20
	 * This Action does not yet serve any Request methods.
21
	 * When a request comes in and this Action is used, execution will be skipped
22
	 * and the View returned by getDefaultViewName() will be used.
23
	 *
24
	 * If an Action has an execute() method, this means it serves all methods.
25
	 * Alternatively, you can implement executeRead() and executeWrite() methods,
26
	 * because "read" and "write" are the default names for Web Request methods.
27
	 * Other request methods may be explicitely served via execcuteReqmethname().
28
	 *
29
	 * Keep in mind that if an Action serves a Request method, validation will be
30
	 * performed prior to execution.
31
	 *
32
	 * Usually, for example for an AddProduct form, your Action should only be run
33
	 * when a POST request comes in, which is mapped to the "write" method by
34
	 * default. Therefor, you'd only implement executeWrite() and put the logic to
35
	 * add the new product to the database there, while for GET (o.e. "read")
36
	 * requests, execution would be skipped, and the View name would be determined
37
	 * using getDefaultViewName().
38
	 *
39
	 * We strongly recommend to prefer specific executeWhatever() methods over the
40
	 * "catchall" execute().
41
	 *
42
	 * Besides execute() and execute*(), there are other methods that might either
43
	 * be generic or specific to a request method. These are:
44
	 * registerValidators() and register*Validators()
45
	 * validate() and validate*()
46
	 * handleError() and handle*Error()
47
	 *
48
	 * The execution of these methods is not dependent on the respective specific
49
	 * execute*() being present, e.g. for a "write" Request, validateWrite() will
50
	 * be run even if there is no executeWrite() method.
51
	 */
52
	public function execute(RequestDataHolder $rd)
53
	{
54
		$this->getContext()->getUser()->logout();
55
		return 'Success';
56
	}
57
}
58
59
?>