DeferredCallbackCollection
class DeferredCallbackCollection implements ArrayAccess, Countable
Properties
| protected DeferredCallback> | $callbacks | All of the deferred callbacks. |
|
| protected bool | $needsDedupe | Whether the callbacks array may contain duplicates that need collapsing on the next read. Set to true by offsetSet() (the only mutation that can introduce a duplicate); cleared only by forgetDuplicates() after a successful rebuild. forget() and offsetUnset() can only remove items, so they cannot introduce duplicates and deliberately leave the flag alone — see forget() for the reasoning. |
Methods
Get the first callback in the collection.
Invoke the deferred callbacks.
Invoke the deferred callbacks if the given truth test evaluates to true.
Remove any deferred callbacks with the given name.
Remove any duplicate callbacks.
Determine if the collection has a callback with the given key.
Get the callback with the given key.
Set the callback with the given key.
Remove the callback with the given key from the collection.
Determine how many callbacks are in the collection.
Details
at line 36
DeferredCallback
first()
Get the first callback in the collection.
at line 46
void
invoke()
Invoke the deferred callbacks.
at line 54
void
invokeWhen(Closure|null $when = null)
Invoke the deferred callbacks if the given truth test evaluates to true.
at line 72
void
forget(string $name)
Remove any deferred callbacks with the given name.
at line 95
protected DeferredCallbackCollection
forgetDuplicates()
Remove any duplicate callbacks.
at line 127
bool
offsetExists(mixed $offset)
Determine if the collection has a callback with the given key.
at line 137
DeferredCallback|null
offsetGet(mixed $offset)
Get the callback with the given key.
at line 147
void
offsetSet(mixed $offset, mixed $value)
Set the callback with the given key.
at line 161
void
offsetUnset(mixed $offset)
Remove the callback with the given key from the collection.
at line 171
int
count()
Determine how many callbacks are in the collection.