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

Added ability to get headers as associative array #19

Merged
merged 10 commits into from
May 5, 2017
Merged

Added ability to get headers as associative array #19

merged 10 commits into from
May 5, 2017

Conversation

mazanax
Copy link
Contributor

@mazanax mazanax commented May 4, 2017

@thinkingserious thinkingserious added the status: code review request requesting a community code review or review from Twilio label May 4, 2017
@SendGridDX
Copy link

SendGridDX commented May 4, 2017

CLA assistant check
All committers have signed the CLA.

@thinkingserious thinkingserious merged commit 7929ea2 into sendgrid:master May 5, 2017
@thinkingserious
Copy link
Contributor

Hello @mazanax,

Thanks again for the PR!

We want to show our appreciation by sending you some swag. Could you please fill out this form so we can send it to you? Thanks!

Team SendGrid DX

*
* @throws \InvalidArgumentException
*/
private function prettifyHeaders($headers)
Copy link

Choose a reason for hiding this comment

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

private function prettifyHeaders(array $headers)

*/
private function prettifyHeaders($headers)
{
if (!is_array($headers)) {
Copy link

Choose a reason for hiding this comment

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

remove condition and exception, you can pass only array type for first argument

}

return array_reduce(
array_filter($headers),
Copy link

Choose a reason for hiding this comment

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

Remove array_filter, you can filter in reduce function

Copy link

Choose a reason for hiding this comment

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

You already filter it in reduce


return array_reduce(
array_filter($headers),
function ($result, $header) {
Copy link

Choose a reason for hiding this comment

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

function (array $result, $header) {

return $result;
}

if (false === strpos($header, ':')) {
Copy link

Choose a reason for hiding this comment

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

Why header not name? Can you provider description this case?
I think is dirty hack

@alexpts
Copy link

alexpts commented May 5, 2017

@mazanax, I added some minor comment for PR

@thinkingserious
Copy link
Contributor

Hi @alexpts,

Thanks for taking the time to review!

Would you mind creating your own PR, since this one is already merged?

Thanks!

With Best Regards,

Elmer

Falseclock pushed a commit to Falseclock/php-http-client that referenced this pull request Jan 30, 2019
Added ability to get headers as associative array
Falseclock pushed a commit to Falseclock/php-http-client that referenced this pull request Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: code review request requesting a community code review or review from Twilio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants