-
Notifications
You must be signed in to change notification settings - Fork 3
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
Request cookie parser #50
base: master
Are you sure you want to change the base?
Conversation
@mpscholten feel free to review and share your thoughts |
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.
Looks good overall :)
* | ||
* $userId = $this->cookieParameter('userId')->int()->defaultsTo(null) | ||
* | ||
* @param $name |
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.
Can we add a string
typehint here?
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.
👍
/** | ||
* @return RequestParser | ||
*/ | ||
public function createCookieParser(); |
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.
This might break existing classes implementing the interface. What do you think about creating a second interface CookieParserFactory
with just the createCookieParser
? Then the specific *RequestParserFactory
implementations can just implements RequestParserFactory, CookieParserFactory
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.
Yep, true 👍 will change that
@@ -40,23 +48,27 @@ public function __construct($request) | |||
$this->request = $request; | |||
} | |||
|
|||
protected function parameter($name) | |||
protected function parameter($name, $cookie = false) |
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.
Can we split this into two functions (parameter
and cookieParameter
)? Otherwise the function is basically doing two things. Here's some interesting discussion on that topic in general: https://softwareengineering.stackexchange.com/questions/147977/is-it-wrong-to-use-a-boolean-parameter-to-determine-behavior
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.
I was actually wondering about it, good point, this discussion solves my conflict :-) good point
Hey @mpscholten, I'll pick it up from where we stopped in the coming days 🙂 thanks for the patience buddy |
No description provided.