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


PHP ReflectionMethod::getExtensionName方法代码示例

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


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

示例1: getExtensionName

 /**
  * Returns false or the name of the extension the method belongs to
  *
  * @return string|boolean False or the name of the extension
  */
 public function getExtensionName()
 {
     if ($this->reflectionSource instanceof ReflectionMethod) {
         return $this->reflectionSource->getExtensionName();
     } else {
         return parent::getExtensionName();
     }
 }
开发者ID:naderman,项目名称:ezc-reflection,代码行数:13,代码来源:method.php

示例2: array

 * will help Emacs organize the snippets into sub-menus, making it
 * easier for the user to navigate once he starts creating a large
 * number of snippets with this program.  PHP groups many functions
 * into 'extensions', so we use the extension name for the group name.
 * Thus a function like json_encode() will get the directive '#group:
 * json'.  If $function actually represents a method then we also try
 * to add the name of the class to the group, creating a sub-group
 * using that class name.
 *
 * However, not all functions and methods belong to an extension.  For
 * methods we still use the class name for the group in the absence of
 * an extension name.  But for functions we omit the '#group'
 * directive if there is no extension name.
 */
$group_name_pieces = array();
if ($function->getExtensionName()) {
    $group_name_pieces[] = $function->getExtensionName();
}
if ($function instanceof ReflectionMethod) {
    $class_name = $function->getDeclaringClass()->getName();
    /* If the class name belongs to a namespace then we create
     * further sub-groups to reflect that.
     */
    str_replace("\\", ".", $class_name);
    $group_name_pieces[] = $class_name;
}
if (count($group_name_pieces) > 0) {
    $snippet_directives[] = sprintf("#group: %s", implode(".", $group_name_pieces));
}
/* We assume the name of the function is already in the buffer and
 * that Emacs will append any output to that.  So we create an array
开发者ID:mcSic,项目名称:emacs-conf,代码行数:31,代码来源:Create-PHP-YASnippet.php


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