示例#1
0
 /**
  * Map a PHP function/object method, to a DataType method.
  *
  * What this actually means is that we can add a mapping between PHP functions (or object methods, as long as the calling
  * parameter is call_user_func/call_user_func_array compatible) and DataType methods. We do this mapping in a special called
  * user-land function, found in the dev/hdr directory;
  *
  * Why?! Because we can map multiple methods to the same PHP function, which should make us be able to call tr_replace
  * or any other function by a common name, (ex. 'replaceStr') ... and issue THE SAME features with our DataTypes, without
  * touching a single line of code, which in fact is a good thing I might add;
  *
  * This is such a special feature, that a couple of tutorials/how-to must be written along side the documentation that we
  * introduce here, where we will be able to clearly show all the advantages that way for working with the framework has, which
  * should make quite a few developers understand why we called it RA [Revolutionary Algorithms] PHP Framework;
  *
  * @return boolean Will map a PHP function to a DT method;
  * @param string $objCalledMethod The called object method that needs to be mapped;
  * @param string $objPHPFunction The PHP function that will take the arguments;
  */
 public static function mapMethodToFunction($objCalledMethod, $objPHPFunction)
 {
     switch (self::$objFuncMapper == NULL) {
         case TRUE:
             // Make it an array;
             self::$objFuncMapper = new A();
         default:
             // Go ... Map-out called methods, to PHP functions;
             self::$objFuncMapper[$objCalledMethod] = $objPHPFunction;
             break;
     }
     // Else, do something;
     return new B(FALSE);
 }