Skip to content

Refactor the HttplugExtension #97

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

Merged
merged 8 commits into from
Jul 24, 2016
Merged

Refactor the HttplugExtension #97

merged 8 commits into from
Jul 24, 2016

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Jul 20, 2016

Q A
Bug fix? yes, or maybe..
New feature? no
BC breaks? no
Deprecations? yes
Related tickets #95
Documentation n/a
License MIT

What's in this PR?

Since the bugs discovered in our extension class I started to refactor it so it would be easier to maintain and understand. This PR will fix #95 or at least be a start of it.

Major changes:

  • All clients are registered with the PluginClient. (even in production)
  • auto toolbar option has been deprecated, defaults to kernel debug

@dbu
Copy link
Collaborator

dbu commented Jul 21, 2016

cool, thanks! https://github.com/php-http/HttplugBundle/blob/master/Tests/Unit/DependencyInjection/HttplugExtensionTest.php is not a comprehensive test, but it looks like at least the basics have no changes.

i think this is going in the right direction. are you confident with it, should we merge it?

@Nyholm
Copy link
Member Author

Nyholm commented Jul 21, 2016

Im confident, but.. I was also confident with 1.2.0. If it works when you try it Im happy to merge. More PRs will come up with more test code.

@Nyholm
Copy link
Member Author

Nyholm commented Jul 21, 2016

I've rebased this PR so we include #98. That would make me more confident.

@dbu
Copy link
Collaborator

dbu commented Jul 21, 2016

can you rebase so that we see if the new tests succeed?

@dbu
Copy link
Collaborator

dbu commented Jul 21, 2016

ups, faster than me :-)

@sagikazarmark LGTM for me, can you have a look too?

} elseif (is_callable($factory)) {
$client = $factory($config);
} else {
throw new \RuntimeException(sprintf('Second argument to PluginClientFactory::createPluginClient must be a "%s" or a callale.', ClientFactory::class));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: callale -> callable

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

}
}
// Tell the plugin journal what plugins we used
$container->getDefinition('httplug.collector.plugin_journal')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is still toolbar dependent. Service only declared in data_collector.xml?

sagikazarmark and others added 2 commits July 24, 2016 11:57
Separating profiling into a separate class does not make the code
cleaner or more readable.

In this commit:

- Profiling moved back to main extension
- Toolbar (profiling) defaults to kernel.debug
Merge Profiling back to main extension
@Nyholm
Copy link
Member Author

Nyholm commented Jul 24, 2016

👍 I like this. This could be merged into master.

@sagikazarmark sagikazarmark modified the milestone: v1.2.3 Jul 24, 2016
@sagikazarmark
Copy link
Member

All clients are registered with the PluginClient. (even in production)

I would add this to the changelog

@sagikazarmark sagikazarmark merged commit a5ef59a into master Jul 24, 2016
@sagikazarmark sagikazarmark deleted the dev-issue95 branch July 24, 2016 12:07
@sagikazarmark sagikazarmark modified the milestones: v1.2.3, v1.3.0 Jul 25, 2016
@sagikazarmark sagikazarmark removed this from the v1.2.3 milestone Jul 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve HttplugExtension
4 participants