xp_signal_history

xp_signal_history()

Returns the current signal history.

The returned history is stored in an array using the following indexes.

<?php
$array = [
    0 => Signal Object
    1 => UNIX timestamp of execution
];
Return type:array

Example #1 Basic Usage

Count the number of XP_SIG('foo') signals that were emitted.

<?php
$sig = XP_SIG('foo');
// Emit a few foo objects
for($i=0;$i<5;$i++){
    xp_emit($sig);
}
$emitted = 0;
foreach(xp_signal_history() as $_node) {
    if ($_node[0] instanceof $sig) {
        $emitted++;
    }
}
echo $emitted;

The above code will output.

5
Read the Docs v: v5.0.1
Versions
latest
v5.0.1
v5.0.0
v4.0.1
v4.0.0
v3.1.1
v3.1.0
v3.0.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.