当前位置: 首页>>代码示例>>PHP>>正文


PHP M::objCLASS方法代码示例

本文整理汇总了PHP中M::objCLASS方法的典型用法代码示例。如果您正苦于以下问题:PHP M::objCLASS方法的具体用法?PHP M::objCLASS怎么用?PHP M::objCLASS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在M的用法示例。


在下文中一共展示了M::objCLASS方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __CALL

 /**
  * Using the magic PHP method __call, as the engine for our 'mapping' scheme;
  *
  * This method, __call, will make a call to a user-defined-function or a PHP-specific function, and process the result, while
  * trying to map the returned result to one of our DataTypes: for short, if the return result is compatible to one of our
  * DataTypes which should be by default, it will return an object of that kind, assuring ST (strong types);
  *
  * In simple terms, it's a nice way to retrieve the result of an action, and making sure the chain is still working. It will
  * return a basic DT, defined in RA, meaning that a return type can make the method-chain go further. Oh, and I forgot to tell
  * you, THE MECHANISM ISN'T RESTRICTED JUST TO PHP FUNCTIONS, MEANING: that if you define a CLASS, or a function that can
  * be called compatible with how call_user_func/call_user_func_array CALLs them, than the power of the mapping mechanism
  * is infinite by definition;
  *
  * Why?! Think of inheritance, what can be done if we're able to call a static method of one of our children?!
  * You guessed, it helps us do 'magic' things ... that are truly ... 'magic' :D. We will document this in a
  * tutorial, because the concept is so complicated in how it was developed, but so simple in how you're going to use it,
  * as it's a shame to let it pass by. The next documentation revision will add the necessary example code;
  *
  * @return mixed Does a call to the user-defined-function and processes the result ...
  * @param string $nameOfHook Name of the invoked method;
  * @param string $argumentsOfHook Arguments passed to that invoked method, that are in a numerically indexed array;
  */
 public function __CALL($nameOfHook, $argumentsOfHook)
 {
     // Get the current CLASS;
     self::$objCLASS = get_class($this);
     // Mapping PHP to DataTypes;
     if (isset(self::$objFuncMapper[$nameOfHook])) {
         // Map to PHPF:
         return CALL_USER_FUNC(self::$objCLASS, $this, $nameOfHook, self::$objFuncMapper[$nameOfHook], $argumentsOfHook);
     } else {
         // Map to USER:
         return CALL_USER_FUNC($nameOfHook, $this, $argumentsOfHook);
     }
 }
开发者ID:ajbm6,项目名称:raphpframework,代码行数:35,代码来源:01_DLL.php


注:本文中的M::objCLASS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。