Add request header accessors (à la PSR-7)#103
Merged
clue merged 2 commits intoreactphp:masterfrom Feb 10, 2017
Merged
Conversation
jsor
approved these changes
Feb 9, 2017
kelunik
suggested changes
Feb 9, 2017
src/Request.php
Outdated
| * there's only a single value or an array of strings if this header has | ||
| * multiple values. | ||
| * | ||
| * Note that this differs from the PSR-7 implementation of this method. |
There was a problem hiding this comment.
It's probably worth mentioning in which way it differs.
WyriHaximus
requested changes
Feb 9, 2017
src/Request.php
Outdated
| * there's only a single value or an array of strings if this header has | ||
| * multiple values. | ||
| * | ||
| * Note that this differs from the PSR-7 implementation of this method. |
src/Request.php
Outdated
| foreach ($this->headers as $key => $value) { | ||
| if (strtolower($key) === $name) { | ||
| foreach((array)$value as $one) { | ||
| $found []= $one; |
Member
There was a problem hiding this comment.
Shouldn't this be $found[] = $one;?
Member
Author
There was a problem hiding this comment.
There are valid reasons for both styles IMO, but I have no real preference here, so yeah 👍
Member
There was a problem hiding this comment.
Not used to this syntax, but I prefer to be consistent 😄
Member
Author
|
Updated |
|
@clue What's the reason for differing from PSR-7 here? I think the PSR-7 behavior makes more sense. |
Member
|
@kelunik mainly that this will go into 0.4.3 and PSR-7 will come in 0.5 so this is more a step in the right direction 😄 |
WyriHaximus
approved these changes
Feb 9, 2017
|
@WyriHaximus I missed that |
Member
|
@kelunik np 😄 |
Member
Author
|
Rebased on current master to resolve merge conflicts |
This was referenced Feb 10, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note that this PR does not implement the PSR-7 interfaces, but follows its method signatures for the header methods to ease a future switch to PSR-7 via #28.
This is also the base for an upcoming PR that fixes #51.