Open andrelec1 opened 6 months ago
Are you talking about the __call()
magic method or the inner switch
statement ?
I talk about the inner switch ....
The switch case statement is here to avoid the poor perf of call_user_func_array ... But all this code can be replaced by this single line : $this->req = $this->req->$method(...$args);
( Argument Unpacking have been implemented in php 5.6 ... lib require php 7.4 so... why not using it ? )
Well it is just a matter of habit, unpacking is indeed a nicest way to do so :)
https://github.com/bluerocktel/sellsy-client/blob/2cd01851855c29c4c10715fcd487e4a6af7b1ef1/src/Core/Request.php#L154
This look like bad code for me... But this is not the first time i see this in random php project.
So some one can explain why using this pattern ?