reflection - PHP Method Chains - Reflecting? -


Is it possible to reflect on a series of method calls to determine if you are in a series of calls? At the very least, it is possible to find out if there is a final call in a series series?

  $ instance-> method1 () - & gt; Method2 () - & gt; Method3 () - & gt; Method4 ()  

Is it possible to use such assets, which return the example of the object?

  $ instances-> property1- & gt; Properties 2- & gt; Properties 3- & gt; Property 4  

If you call back all the ways same Returning objects to create a fluent interface (as opposed to pasting different objects together), this object must be quite trivial to record call calls.

Example:

  class example {secured $ _callStack = array}; Public function F1 () {$ this-> _callStack [] = __METHOD__; // Other Work} Public Function F2 () {$ this-> _callStack [] = __METHOD__; // other work} public function getCallStack () {return $ this- & gt; _callStack; }}  

then chain like a call

  $ a = new example; To $ one & gt; F1 () - & gt; F2 () - & gt; F1 ();  

Leave as a call stack: Array ('F1', 'F2', 'F1');


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -