-
Notifications
You must be signed in to change notification settings - Fork 66
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
Conversation
* | ||
* @throws \InvalidArgumentException | ||
*/ | ||
private function prettifyHeaders($headers) |
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.
private function prettifyHeaders(array $headers)
*/ | ||
private function prettifyHeaders($headers) | ||
{ | ||
if (!is_array($headers)) { |
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.
remove condition and exception, you can pass only array type for first argument
} | ||
|
||
return array_reduce( | ||
array_filter($headers), |
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.
Remove array_filter, you can filter in reduce function
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.
You already filter it in reduce
|
||
return array_reduce( | ||
array_filter($headers), | ||
function ($result, $header) { |
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.
function (array $result, $header) {
return $result; | ||
} | ||
|
||
if (false === strpos($header, ':')) { |
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.
Why header not name? Can you provider description this case?
I think is dirty hack
@mazanax, I added some minor comment for PR |
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 |
Added ability to get headers as associative array
Implemented sendgrid/sendgrid-php#361