本文整理汇总了PHP中M::objFuncMapper方法的典型用法代码示例。如果您正苦于以下问题:PHP M::objFuncMapper方法的具体用法?PHP M::objFuncMapper怎么用?PHP M::objFuncMapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类M
的用法示例。
在下文中一共展示了M::objFuncMapper方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mapMethodToFunction
/**
* 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);
}