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


PHP ReflectionFunctionAbstract::getShortName方法代码示例

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


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

示例1: fromReflection

 /**
  * Creates a function signature instance from the supplied reflection.
  *
  * @param \ReflectionFunctionAbstract $reflection
  *
  * @return self
  */
 public static function fromReflection(\ReflectionFunctionAbstract $reflection)
 {
     $returnsReference = $reflection->returnsReference();
     $name = $reflection->getShortName();
     $parameterExpressions = self::getParameterExpressionsFromReflection($reflection);
     if ($reflection->isClosure()) {
         return self::closure($returnsReference, $parameterExpressions, array_keys($reflection->getStaticVariables()));
     } elseif ($reflection instanceof \ReflectionMethod) {
         if ($reflection->isPublic()) {
             $accessModifier = self::ACCESS_PUBLIC;
         } elseif ($reflection->isProtected()) {
             $accessModifier = self::ACCESS_PROTECTED;
         } else {
             $accessModifier = self::ACCESS_PRIVATE;
         }
         if ($reflection->isAbstract()) {
             $polymorphModifier = self::POLYMORPH_ABSTRACT;
         } elseif ($reflection->isFinal()) {
             $polymorphModifier = self::POLYMORPH_FINAL;
         } else {
             $polymorphModifier = null;
         }
         return self::method($returnsReference, $accessModifier, $polymorphModifier, $reflection->isStatic(), $name, $parameterExpressions);
     } else {
         return self::func($returnsReference, $name, $parameterExpressions);
     }
 }
开发者ID:timetoogo,项目名称:pinq,代码行数:34,代码来源:FunctionSignature.php

示例2: __construct

 public function __construct(ReflectionFunctionAbstract $method)
 {
     $this->name = $method->getShortName();
     $this->filename = $method->getFilename();
     $this->startline = $method->getStartLine();
     $this->endline = $method->getEndLine();
     $this->docstring = $method->getDocComment();
     $this->operator = $this->static ? Kint_Object::OPERATOR_STATIC : Kint_Object::OPERATOR_OBJECT;
     $this->access = Kint_Object::ACCESS_PUBLIC;
     if ($method instanceof ReflectionMethod) {
         $this->static = $method->isStatic();
         $this->abstract = $method->isAbstract();
         $this->final = $method->isFinal();
         $this->owner_class = $method->getDeclaringClass()->name;
         if ($method->isProtected()) {
             $this->access = Kint_Object::ACCESS_PROTECTED;
         } elseif ($method->isPrivate()) {
             $this->access = Kint_Object::ACCESS_PRIVATE;
         }
     }
     foreach ($method->getParameters() as $param) {
         $this->parameters[] = new Kint_Object_Parameter($param);
     }
     if ($this->docstring) {
         if (preg_match('/@return\\s+(.*)\\r?\\n/m', $this->docstring, $matches)) {
             if (!empty($matches[1])) {
                 $this->returntype = $matches[1];
             }
         }
     }
     $docstring = new Kint_Object_Representation_Docstring($this->docstring, $this->filename, $this->startline);
     $docstring->implicit_label = true;
     $this->addRepresentation($docstring);
 }
开发者ID:jnvsor,项目名称:kint,代码行数:34,代码来源:Method.php


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