For example, let's say I have a set of classes and methods for this:
$obj->method1()->method2();
In any case, for method1 () to know by itself that its first method is called, or for method2 to know that its last?
Additional information
I just want to be able to create a set of these calls so that it either returns an instance of itself if the method call is not at the end of the chain, or returns something else if it is at the end.
for example
$obj->method1()->method2();
$obj->method1()->method2()->method3();
EDIT: any whoz trying to do this is a bad design.
It looks like a duplicate. See this question for more details .
source
share