-
Notifications
You must be signed in to change notification settings - Fork 53
Added possibility for debug plugins #22
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
This looks like an interesting idea to me. |
/* | ||
* Inject debug plugins between each plugin. | ||
*/ | ||
$pluginListWithDegug = $this->options['debug_plugins']; |
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.
s/Degug/Debug/
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 dont know whats wrong with me. I've corrected this typo at least 10 times...
Thank you.
looks interesting! i think we should have a tiny bit of phpdoc in the constructor. it was not obvious to me from looking at it what this does. |
Ping @joelwurtz. It this similar what you had in mind? php-http/HttplugBundle#26 (comment) |
@@ -44,7 +44,8 @@ | |||
* @param Plugin[] $plugins | |||
* @param array $options { | |||
* | |||
* @var int $max_restarts | |||
* @var int $max_restarts | |||
* @var Plugin[] $debug_plugins an array of plugins that are injected between all normal plugins |
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.
s/all normal plugins/each normal plugin/
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.
looks good to me. lets wait for feedback from @joelwurtz ? @Nyholm is this ready to merge from your point of view? aka does it work in the HttplugBundle ? |
Yes it is ready for merge. |
@@ -110,6 +111,7 @@ private function configure(array $options = []) | |||
$resolver = new OptionsResolver(); | |||
$resolver->setDefaults([ | |||
'max_restarts' => 10, | |||
'debug_plugins' => [], |
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.
Can we add a type check for plugins somewhere? Does the OptionsResolver support "an array of type" check?
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.
Not sure if this would be better in a DebugPluginClient which extends from PluginClient, i just don't like to mix "debug" properties in "real classes". Also tests are missing :) Otherwise 👍 for this |
Thank you for the feedback. I've updated the PR. |
looks good to me. for this scenario, i see no problem in having debug handled inside the plugin client. thinking from symfony, you will sometimes pass a debug plugin and sometimes not. extending the client would make this a lot more complicated. |
squash and merge? |
Thank you for merging. |
What's in this PR?
This PR gives the possibility to add debug plugins. A debug plugin is executed between each normal plugin
Why?
With this PR we can show better diffs and how different plugins are changing the requests/responses.
Checklist