I'm thinking about creating a class that uses method chaining. What I'm trying to achieve is the type the output of methods, based if the methods are chained or not.
Example 1:
$var = $instance->user($id);
Returns an array with the necessary information.
Example 2:
$var = $instance->user($id)->action($arg);
I want the chained method in front of user() to just pass the argument $id to the next method and for it not to output anything. Then the method action() grabs the $id and return what's asked.
How can I achieve this?
The reason I want don't want to make user() return its normal result code is because I intend to use this in an API wrapper. Returning the "normal" user() will cost me an additional X-Rate-Limit call. If I could spare this call, and just pass the parameter $id to the second method, that would be the ideal.