本文整理汇总了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();
}
}
示例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