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

Constructor's parameter order #4

Closed
gregmartyn opened this issue Sep 7, 2016 · 3 comments
Closed

Constructor's parameter order #4

gregmartyn opened this issue Sep 7, 2016 · 3 comments
Labels

Comments

@gregmartyn
Copy link

The constructor's parameter list is mostly the same as setcookie(), with the exception of httpOnly and secureOnly, which are swapped. Would you consider swapping them in a future version so that they align with setcookie()?

I was porting some code that was using setcookie() to using the PHP-Cookie constructor and noticed that it's very easy to miss that.

@ocram ocram added the question label Sep 13, 2016
@ocram
Copy link
Contributor

ocram commented Sep 13, 2016

Thanks a lot for your feedback on this!

What method's signature are you talking about, exactly?

The Cookie::setcookie(...) method, which has been added as a replacement for PHP's native function of the same name, is fully compatible with the PHP function, as you can see here.

The constructor, on the other hand, has only one parameter, which is the cookie's name, as you can see here. All the other attributes on instances are set via the setters which cannot really be mixed up, right?

@gregmartyn
Copy link
Author

Oh, oops, you're right. I saw it doing $this->name = ... $this->value = ... etc and I guess I assumed the constructor was being passed all those parameters in order. Nothing to see here..

@ocram
Copy link
Contributor

ocram commented Sep 13, 2016

No problem, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants