-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose the internal middleware queue in MiddlewarePipe
as an iterable
#57
Conversation
Returns the internal `SplQueue` as an array so that users can inspect the pipeline. Signed-off-by: George Steel <george@net-glue.co.uk>
a80f851
to
8f7a08c
Compare
src/MiddlewarePipeInterface.php
Outdated
/** @return list<MiddlewareInterface> */ | ||
public function toArray(): array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO not to be interfaced 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought so too… If you need the convenience of inspecting the pipeline, like in tests, then it's not much to ask to first assert the implementation type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a new interface with no additional methods that extends from MiddlewarePipeInterface
and IteratorAggregate
so that users can test for IterableMiddlewarePipeInterface
and simply call iterator_to_array
on the pipeline instance. Better?
…implementation. Signed-off-by: George Steel <george@net-glue.co.uk>
toArray
to MiddlewarePipeInterface
toArray
to MiddlewarePipe
…g the pipeline itself iterable Signed-off-by: George Steel <george@net-glue.co.uk>
toArray
to MiddlewarePipe
MiddlewarePipe
as an iterable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
/** @extends IteratorAggregate<int, MiddlewareInterface> */ | ||
interface IterableMiddlewarePipeInterface extends MiddlewarePipeInterface, IteratorAggregate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is not internal, I would describe it: other than that, all good!
Signed-off-by: George Steel <george@net-glue.co.uk>
Description
Returns the internal
SplQueue
as an array so that users can inspect the pipeline.Closes #44