Welcome Guest, Not a member yet? Register   Sign In
The Request class rework
#4

(This post was last modified: 12-08-2021, 08:48 PM by iRedds.)

(12-08-2021, 04:37 PM)includebeer Wrote: It's only my opinion, but I find it even more confusing... I don't see that as an improvement. Your get() method returns data from $_POST. Why not from $_GET?  What's the use case for get('c', 4) if it completely ignores c and always return 4?

Thank you. Maybe I forgot, but it seems to me that this is the first time I get feedback on this forum thread.

It seems to me that a possible reason why you do not understand why the get() method works with _POST, and not with _GET, is that you see the http method in the basis of the request, and I see the data.
The get() method works with the current HTTP method. Be it GET/POST/PUST/DELETE/PATCH/etc
That is, get() ! == _GET. get() === get the request data.

get('c', 4) returns 4 because there is no "c" parameter in the current POST request. Therefore, the get() method returns a default value.

(12-08-2021, 05:09 PM)kenjis Wrote: I feel your APIs are a bit cleaner, but
I'm not sure what the benefit would be to change the current APIs.
As includebeer says it may be more confusing for the current users.

Also, what about compliance with PSR-7?

I have already commented on your PR. Let me explain. Now you cannot get the default value of a variable if it is not in the request. If the variable is not defined you will always get NULL. Although NULL may be one of the expected values.
Yes. Users may not immediately understand the nature of the changes.

PSR-7 does not regulate in any way how to get the request data.
Reply


Messages In This Thread
The Request class rework - by iRedds - 12-07-2021, 11:53 PM
RE: The Request class rework - by includebeer - 12-08-2021, 04:37 PM
RE: The Request class rework - by iRedds - 12-08-2021, 08:21 PM
RE: The Request class rework - by kenjis - 12-09-2021, 07:10 PM
RE: The Request class rework - by kenjis - 12-08-2021, 05:09 PM
RE: The Request class rework - by includebeer - 12-09-2021, 05:28 PM
RE: The Request class rework - by iRedds - 12-09-2021, 09:32 PM
RE: The Request class rework - by kenjis - 12-10-2021, 02:39 AM
RE: The Request class rework - by iRedds - 12-10-2021, 03:04 AM
RE: The Request class rework - by kenjis - 12-10-2021, 04:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB