Event.php 1.37 KB
Newer Older
Qiang Xue committed
1
<?php
w  
Qiang Xue committed
2 3
/**
 * @link http://www.yiiframework.com/
Qiang Xue committed
4
 * @copyright Copyright (c) 2008 Yii Software LLC
w  
Qiang Xue committed
5 6
 * @license http://www.yiiframework.com/license/
 */
Qiang Xue committed
7 8 9 10

namespace yii\base;

/**
Qiang Xue committed
11
 * Event is the base class for all event classes.
Qiang Xue committed
12 13
 *
 * It encapsulates the parameters associated with an event.
w  
Qiang Xue committed
14 15 16
 * The [[sender]] property describes who raises the event.
 * And the [[handled]] property indicates if the event is handled.
 * If an event handler sets [[handled]] to be true, the rest of the
m  
Qiang Xue committed
17
 * uninvoked handlers will no longer be called to handle the event.
Qiang Xue committed
18
 * Additionally, an event may specify extra parameters via the [[data]] property.
Qiang Xue committed
19 20
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
w  
Qiang Xue committed
21
 * @since 2.0
Qiang Xue committed
22
 */
Qiang Xue committed
23
class Event extends \yii\base\Object
Qiang Xue committed
24
{
w  
Qiang Xue committed
25
	/**
Qiang Xue committed
26
	 * @var string the event name. This property is set by [[Component::trigger()]].
w  
Qiang Xue committed
27 28 29
	 * Event handlers may use this property to check what event it is handling.
	 */
	public $name;
Qiang Xue committed
30
	/**
Qiang Xue committed
31 32
	 * @var object the sender of this event. If not set, this property will be
	 * set as the object whose "trigger()" method is called.
Qiang Xue committed
33 34 35 36
	 */
	public $sender;
	/**
	 * @var boolean whether the event is handled. Defaults to false.
w  
Qiang Xue committed
37 38
	 * When a handler sets this to be true, the event processing will stop and
	 * ignore the rest of the uninvoked event handlers.
Qiang Xue committed
39
	 */
Qiang Xue committed
40
	public $handled = false;
m  
Qiang Xue committed
41
	/**
Qiang Xue committed
42
	 * @var mixed extra custom data associated with the event.
m  
Qiang Xue committed
43
	 */
Qiang Xue committed
44
	public $data;
Qiang Xue committed
45
}