-
Notifications
You must be signed in to change notification settings - Fork 58
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
Implement Check_Collection
to separate concerns for check filtering from Check_Repository
#315
Implement Check_Collection
to separate concerns for check filtering from Check_Repository
#315
Conversation
…rom Check_Repository.
It's worth noting that this PR also fixes a bug: Before this, Now, it returns the collection and then the caller can decide whether they need the map or array format, via |
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.
Thank you, @felixarntz, for the PR. It looks quite solid from my perspective. I've left some feedback to seek clarification on certain points.
…onality to fail if an invalid check slug is given.
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.
Thanks @felixarntz for the changes. LGTM from my end.
This PR introduces a
Check_Collection
interface, primarily with the purpose of providing enhanced filtering of checks to run, while decoupling that from theCheck_Repository
responsibilities.The
Check_Repository
was introduced as the central place to register checks, and while a limited flag based selection mechanism makes sense in the scope of that class, the parameter for filtering down to specific checks wasn't really well thought through, which becomes more obvious when considering #308:Check_Repository::get_checks()
to allow further ways to filter.Check_Repository
and partially elsewhere.The
Check_Collection
approaches relies on sort of a "builder" pattern whereCheck_Repository::get_checks()
returns a collection that allows further filtering and largely can be used like an array. Ato_array()
method and ato_map()
method are present to return the under-the-hood array representation. Internally, the checks are stored in the collection with their slugs to provide the necessary filtering and lookup capabilities.