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

Request cookie parser #50

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

Request cookie parser #50

wants to merge 5 commits into from

Conversation

yuvalherziger
Copy link
Collaborator

No description provided.

@yuvalherziger yuvalherziger changed the title [WIP] Cookie parser Request cookie parser Oct 16, 2017
@yuvalherziger
Copy link
Collaborator Author

@mpscholten feel free to review and share your thoughts

Copy link
Owner

@mpscholten mpscholten left a 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
Copy link
Owner

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?

Copy link
Collaborator Author

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();
Copy link
Owner

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

Copy link
Collaborator Author

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)
Copy link
Owner

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

Copy link
Collaborator Author

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

@yuvalherziger
Copy link
Collaborator Author

Hey @mpscholten, I'll pick it up from where we stopped in the coming days 🙂 thanks for the patience buddy

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