Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66856951
PhutilEventListener.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jun 18, 12:37
Size
873 B
Mime Type
text/x-php
Expires
Thu, Jun 20, 12:37 (2 d)
Engine
blob
Format
Raw Data
Handle
18306022
Attached To
rPHU libphutil
PhutilEventListener.php
View Options
<?php
/**
* @group event
* @stable
*/
abstract
class
PhutilEventListener
{
private
$listenerID
;
private
static
$nextListenerID
=
1
;
final
public
function
__construct
()
{
// <empty>
}
abstract
public
function
register
();
abstract
public
function
handleEvent
(
PhutilEvent
$event
);
final
public
function
listen
(
$type
)
{
$engine
=
PhutilEventEngine
::
getInstance
();
$engine
->
addListener
(
$this
,
$type
);
}
/**
* Return a scalar ID unique to this listener. This is used to deduplicate
* listeners which match events on multiple rules, so they are invoked only
* once.
*
* @return int A scalar unique to this object instance.
*/
final
public
function
getListenerID
()
{
if
(!
$this
->
listenerID
)
{
$this
->
listenerID
=
self
::
$nextListenerID
;
self
::
$nextListenerID
++;
}
return
$this
->
listenerID
;
}
}
Event Timeline
Log In to Comment