Skip to content

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

}

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.

3 participants