CRUDlex\AbstractData::popEvent PHP Method

popEvent() public method

Removes and returns the latest event for the given parameters.
public popEvent ( string $moment, string $action ) : Closure | null
$moment string the "moment" of the event, can be either "before" or "after"
$action string the "action" of the event, can be either "create", "update" or "delete"
return Closure | null the popped event or null if no event was available.
    public function popEvent($moment, $action)
    {
        if (array_key_exists($moment . '.' . $action, $this->events)) {
            return array_pop($this->events[$moment . '.' . $action]);
        }
        return null;
    }