-
Notifications
You must be signed in to change notification settings - Fork 206
Define API params in order to be able to filter correctly #413
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
Conversation
| $all_params = $this->server->getAllParams([ | ||
| 'w' => '100', | ||
| 'p' => 'small', | ||
| 'invalid' => '1', |
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.
@ADmad I realize I added some fixes that are out of scope of the issue, but this is the test fixing the cache path issue
I believe it shouldn't accept invalid parameters
ADmad
left a comment
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.
no BC break
Adding a new interface method is very much a BC break 🙂
But I think it's worth it in this case, given the improvement it provides.
src/Api/Api.php
Outdated
| $params = []; | ||
|
|
||
| array_walk($this->manipulators, function (ManipulatorInterface $manipulator) use (&$params) { | ||
| foreach ($manipulator->getApiParams() as $param) { |
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.
Why loop through each instead of using array merge?
src/Api/Api.php
Outdated
| foreach ($manipulator->getApiParams() as $param) { | ||
| $this->apiParams[] = $param; | ||
| } |
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.
| foreach ($manipulator->getApiParams() as $param) { | |
| $this->apiParams[] = $param; | |
| } | |
| $this->apiParams = array_merge($this->apiParams, $manipulator->getApiParams()); |
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 was over-complicating this, thanks for pointing it out!
src/Manipulators/BaseManipulator.php
Outdated
| * | ||
| * @return list<string> | ||
| */ | ||
| abstract public function getApiParams(): 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.
We don't need this abstract method because it is defined already in ManipulatorInterface
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 agree, I was following what was done for the run method, I removed both from BaseManipulator
Uh oh!
There was an error while loading. Please reload this page.