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


PHP Method::set_access_public方法代码示例

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


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

示例1: create_delegate_for_reflection

 /**
  * Creates a Method which, when called, will delegate to a given instance variable
  */
 public static function create_delegate_for_reflection(\ReflectionMethod $method, $variable)
 {
     $method_name = $method->getName();
     $m = new Method($method_name);
     $m->set_arg_list(ArgumentList::create_from_reflection_method($method));
     if ($method->returnsReference()) {
         $m->set_reference_returned(true);
     }
     if ($method->isPublic()) {
         $m->set_access_public();
     } elseif ($method->isProtected()) {
         $m->set_access_protected();
     } elseif ($method->isPrivate()) {
         $m->set_access_private();
     }
     $body = '
         return call_user_func_array(
             array($this->' . $variable . ', "' . $method_name . '"),
             func_get_args()
         );
     ';
     $m->set_body(trim(preg_replace('/\\s+/', ' ', $body)));
     return $m;
 }
开发者ID:jaz303,项目名称:phpx,代码行数:27,代码来源:members.php


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