Completed
Push — master ( 650043...fc1ed5 )
by Evstati
13s
created

Kohana_Jam_Event_Data::stop()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
ccs 0
cts 3
cp 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php defined('SYSPATH') OR die('No direct script access.');
2
/**
3
 * Jam Event Data is the object passed to all events
4
 *
5
 * It contains a set of public properties passed to it
6
 * whoever triggered the event as well as the name of
7
 * the event being called.
8
 *
9
 * Set `return` to whatever value you'd like to return,
10
 * though you should keep in mind that other events,
11
 * that come after may modify that value, so set
12
 * `stop` to TRUE if you want to prevent the chain from
13
 * continuing.
14
 *
15
 * @package    Jam
16
 * @category   Events
17
 * @author     Jonathan Geiger
18
 * @copyright  (c) 2010-2011 Jonathan Geiger
19
 * @license    http://www.opensource.org/licenses/isc-license.txt
20
 */
21
abstract class Kohana_Jam_Event_Data {
22
23
	/**
24
	 * @var  string  The name of the event
25
	 */
26
	public $event = NULL;
27
28
	/**
29
	 * @var  mixed  The sender of the event
30
	 */
31
	public $sender = NULL;
32
33
	/**
34
	 * @var  args  An array of args sent to the event
35
	 */
36
	public $args = array();
37
38
	/**
39
	 * @var  mixed  The return value of the event
40
	 */
41
	public $return = NULL;
42
43
	/**
44
	 * @var  boolean  Whether or not to stop execution of events
45
	 */
46
	public $stop = FALSE;
47
48
	/**
49
	 * Throws all event parameters into the object as public variables
50
	 *
51
	 * @param  array  $params
52
	 */
53 35
	public function __construct($params)
54
	{
55 35
		foreach ($params as $param => $value)
56
		{
57 22
			$this->$param = $value;
58
		}
59 35
	}
60
61
	/**
62
	 * Stops execution of the event
63
	 *
64
	 * @return void
65
	 */
66
	public function stop()
67
	{
68
		$this->stop = TRUE;
69
	}
70
71
} // End Kohana_Jam_Event_Data
72