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

Add transport method to url #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

igordrnobrega
Copy link

Problem
I think is a problem to have transport method hardcoded in line 81 cause it removes the flexibility of the code.

Solution
I'm adding the viability of setting it in the constructor without the need of creating or setting a new client for it and letting the class handle the client.
I also made some fix on some standards like optional parameters at the end of function declaration and type hinted $method in doRequest function

yield ['http'];
yield ['https'];
}

Choose a reason for hiding this comment

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

Why are you using yield here?

Copy link
Author

Choose a reason for hiding this comment

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

Data providers do not indeed need an array as a return, but an iterator can fit better for making them a little more readable.

{
$adapter = new APC();
$registry = new CollectorRegistry($adapter);

$counter = $registry->registerCounter('test', 'some_counter', 'it increases', ['type']);
$counter->incBy(6, ['blue']);

$pushGateway = new PushGateway('pushgateway:9091');
$pushGateway = new PushGateway('pushgateway:9091', $transport);

Choose a reason for hiding this comment

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

Your code here doesn't match the constructor signature.

@NoelDavies
Copy link

@igordrnobrega, any updates to the PR review above?

@igordrnobrega
Copy link
Author

Sorry for the, almost, 2 months delay on this, but I was really busy this end of the year.

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