mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add new query args to Pattern Directory Controller #3861
Closed
ntsekouras
wants to merge
7
commits into
WordPress:trunk
from
ntsekouras:backport/new-query-args-pattern-directory-controller
Closed
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f827f07
Add new query args to Pattern Directory Controller
ntsekouras 1cede3c
Simplify and tweak performance of query_args construction
hellofromtonya 08dd54f
Removes gutenberg text context
hellofromtonya e7301ef
Add params as keys to test dataset
hellofromtonya 1f4dd3d
Adds assert messages to identify which assertion failed
hellofromtonya 824488d
Make clear that "pre_http_request" is a mocked callback
hellofromtonya feee687
Rearrangement of test annotations
hellofromtonya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This code can be simplified and made more performant:
The
array_flip()
creates an array with the values of$valid_query_args
as the keys. Since this is used only for filtering the args, why not set up the$valid_query_args
into a keyed structure? In doing so, thearray_flip()
is eliminated.The
array_merge()
also creates another array. As'locale'
and'wp-version'
keys will not be in the array after doing thearray_intersect_key()
, a more performant way is to directly adding them to$query_args
rather thanarray_merge()
.The changes remove 2 unnecessary array iterations and creations.
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.
Fixed in 1cede3c.
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.
See it in action https://3v4l.org/DGvja
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 @hellofromtonya !