Skip to content
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

fix: make it possible to inject http client into factories #155

Merged
merged 1 commit into from
Dec 8, 2024

Conversation

chr-hertel
Copy link
Member

No description provided.

@chr-hertel chr-hertel force-pushed the fix-http-client-factory branch from 44abd56 to 7d8613f Compare December 8, 2024 00:51
@chr-hertel chr-hertel merged commit 8b88d5d into main Dec 8, 2024
7 checks passed
@chr-hertel chr-hertel deleted the fix-http-client-factory branch December 8, 2024 01:30
public static function create(#[\SensitiveParameter] string $apiKey, string $version = '2023-06-01'): Platform
{
$responseHandler = new ModelHandler(new EventSourceHttpClient(), $apiKey, $version);
public static function create(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not using a withHttpClient() method?

Copy link
Member Author

Choose a reason for hiding this comment

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

As a separate method? What's the benefit?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can instantiate it and change it later, maybe because you want to inject a traceable http client later + you could return a clone to stay immutable, but just an idea and maybe not needed

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, that was basically the motivation here - to use the factory in the bundle but use the traceable one instantiated by the framework already

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.

2 participants