EmitterStack
extends SplStack
in package
implements
EmitterInterface
Provides an EmitterInterface implementation that acts as a stack of Emitters.
The implementations emit() method iterates itself.
When iterating the stack, the first emitter to return a boolean true value will short-circuit iteration.
Tags
Table of Contents
Interfaces
Methods
- emit() : bool
- Emit a response
- offsetSet() : void
- Set an emitter on the stack by index.
- push() : void
- Push an emitter to the stack.
- unshift() : void
- Unshift an emitter to the stack.
- validateEmitter() : void
- Validate that an emitter implements EmitterInterface.
Methods
emit()
Emit a response
public
emit(ResponseInterface $response) : bool
Loops through the stack, calling emit() on each; any that return a boolean true value will short-circuit, skipping any remaining emitters in the stack.
As such, return a boolean false value from an emitter to indicate it cannot emit the response, allowing the next emitter to try.
Parameters
- $response : ResponseInterface
Return values
booloffsetSet()
Set an emitter on the stack by index.
public
offsetSet(int $offset, EmitterInterface $value) : void
Parameters
- $offset : int
- $value : EmitterInterface
Tags
Attributes
- #[ReturnTypeWillChange]
push()
Push an emitter to the stack.
public
push(EmitterInterface $value) : void
Parameters
- $value : EmitterInterface
Tags
Attributes
- #[ReturnTypeWillChange]
unshift()
Unshift an emitter to the stack.
public
unshift(EmitterInterface $value) : void
Parameters
- $value : EmitterInterface
Tags
Attributes
- #[ReturnTypeWillChange]
validateEmitter()
Validate that an emitter implements EmitterInterface.
private
validateEmitter(mixed $emitter) : void
Parameters
- $emitter : mixed