PHP Class Bluz\EventManager\Event

Show file Open project: bluzphp/framework Class Usage Examples

Protected Properties

Property Type Description
$name event name
$params the event parameters
$target the event target

Public Methods

Method Description
__construct ( string $name, string | object $target = null, array | object $params = null ) Constructor
getName ( ) : string Get event name
getParam ( string | integer $name, mixed $default = null ) : mixed Get an individual parameter
getParams ( ) : array | object Get all parameters
getTarget ( ) : string | object Get the event target
setName ( string $name ) : Event Set the event name
setParam ( string | integer $name, mixed $value ) : Event Set an individual parameter to a value
setParams ( array | object $params ) : Event Overwrites parameters
setTarget ( null | string | object $target ) : Event Set the event target/context

Method Details

__construct() public method

Accept a target and its parameters.
public __construct ( string $name, string | object $target = null, array | object $params = null )
$name string Event name
$target string | object
$params array | object

getName() public method

Get event name
public getName ( ) : string
return string

getParam() public method

If the parameter does not exist, the $default value will be returned.
public getParam ( string | integer $name, mixed $default = null ) : mixed
$name string | integer
$default mixed
return mixed

getParams() public method

Get all parameters
public getParams ( ) : array | object
return array | object

getTarget() public method

This may be either an object, or the name of a static method.
public getTarget ( ) : string | object
return string | object

setName() public method

Set the event name
public setName ( string $name ) : Event
$name string
return Event

setParam() public method

Set an individual parameter to a value
public setParam ( string | integer $name, mixed $value ) : Event
$name string | integer
$value mixed
return Event

setParams() public method

Overwrites parameters
public setParams ( array | object $params ) : Event
$params array | object
return Event

setTarget() public method

Set the event target/context
public setTarget ( null | string | object $target ) : Event
$target null | string | object
return Event

Property Details

$name protected property

event name
protected $name

$params protected property

the event parameters
protected $params

$target protected property

the event target
protected $target