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


PHP ReflectionFunctionAbstract::isClosure方法代码示例

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


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

示例1: getFunctionName

 private function getFunctionName(\ReflectionFunctionAbstract $reflectionFunction)
 {
     if ($reflectionFunction->isClosure()) {
         return sprintf('closure defined in %s at line %d', $reflectionFunction->getFileName(), $reflectionFunction->getStartLine());
     } elseif ($reflectionFunction instanceof \ReflectionMethod) {
         return sprintf('%s::%s', $reflectionFunction->getDeclaringClass()->getName(), $reflectionFunction->getName());
     }
     return $reflectionFunction->getName();
 }
开发者ID:jhonleandres,项目名称:batata,代码行数:9,代码来源:FunctionCallDefinitionDumper.php

示例2: __toString

 /**
  * Print the signature of the target action.
  * 
  * @return string
  */
 public function __toString()
 {
     if ($this->target instanceof \ReflectionMethod) {
         return sprintf('%s->%s()', $this->target->getDeclaringClass()->name, $this->target->name);
     }
     if ($this->target instanceof \ReflectionFunction && !$this->target->isClosure()) {
         return $this->target->getName() . '()';
     }
     return '*closure*';
 }
开发者ID:koolkode,项目名称:http-komponent,代码行数:15,代码来源:ActionFilterChain.php

示例3: fromReflection

 /**
  * Creates a function scope instance from the supplied reflection and callable.
  *
  * @param \ReflectionFunctionAbstract $reflection
  * @param callable                    $callable
  *
  * @return self
  */
 public static function fromReflection(\ReflectionFunctionAbstract $reflection, callable $callable)
 {
     if (is_array($callable)) {
         /** @var $reflection \ReflectionMethod */
         $thisObject = is_object($callable[0]) ? $callable[0] : null;
         $scopeType = $reflection->getDeclaringClass()->getName();
     } elseif (is_object($callable) && !$callable instanceof \Closure) {
         /** @var $reflection \ReflectionMethod */
         $thisObject = $callable;
         $scopeType = $reflection->getDeclaringClass()->getName();
     } elseif ($reflection->isClosure()) {
         $thisObject = $reflection->getClosureThis();
         $scopeClass = $reflection->getClosureScopeClass();
         $scopeType = $scopeClass === null ? null : $scopeClass->getName();
     } else {
         $thisObject = null;
         $scopeType = null;
     }
     $variableTable = $reflection->getStaticVariables();
     return new self($thisObject, $scopeType, $variableTable);
 }
开发者ID:timetoogo,项目名称:pinq,代码行数:29,代码来源:FunctionScope.php

示例4: getCalledMethod

 /**
  * Get called method from abstract reflection function
  *
  * @param \ReflectionFunctionAbstract $method
  * @param bool                        $closureInfo
  *
  * @return string
  */
 public static function getCalledMethod(\ReflectionFunctionAbstract $method, $closureInfo = true)
 {
     if ($method->isClosure()) {
         if ($closureInfo) {
             return sprintf('Closure [%s:%d]', $method->getFileName(), $method->getStartLine());
         }
         return 'Closure';
     }
     if ($method instanceof \ReflectionMethod) {
         return sprintf('%s::%s', $method->getDeclaringClass()->getName(), $method->getName());
     }
     return $method->getName();
 }
开发者ID:Gtvar,项目名称:FivePercent-Reflection,代码行数:21,代码来源:Reflection.php

示例5:

 function it_returns_its_line_number_as_zero_if_constructed_with_closure(\ReflectionFunctionAbstract $function)
 {
     $function->isClosure()->willReturn(true);
     $this->getLineNumber()->shouldReturn(0);
 }
开发者ID:phpspec,项目名称:phpspec,代码行数:5,代码来源:ExampleNodeSpec.php

示例6: prepareCallbackArguments

 /**
  * Merges found arguments with multiliners and maps them to the function callback signature.
  *
  * @param ContextInterface            $context   context instance
  * @param \ReflectionFunctionAbstract $refl      callback reflection
  * @param array                       $arguments found arguments
  * @param array                       $multiline multiline arguments of the step
  *
  * @return array
  */
 private function prepareCallbackArguments(ContextInterface $context, \ReflectionFunctionAbstract $refl, array $arguments, array $multiline)
 {
     $parametersRefl = $refl->getParameters();
     if ($refl->isClosure()) {
         array_shift($parametersRefl);
     }
     $resulting = array();
     foreach ($parametersRefl as $num => $parameterRefl) {
         if (isset($arguments[$parameterRefl->getName()])) {
             $resulting[] = $arguments[$parameterRefl->getName()];
         } elseif (isset($arguments[$num])) {
             $resulting[] = $arguments[$num];
         }
     }
     foreach ($multiline as $argument) {
         $resulting[] = $argument;
     }
     return $resulting;
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:29,代码来源:DefinitionDispatcher.php

示例7: getCallbackSignature

 protected function getCallbackSignature(\ReflectionFunctionAbstract $ref)
 {
     if ($ref instanceof \ReflectionMethod) {
         return $ref->getDeclaringClass()->name . '->' . $ref->name . '()';
     }
     if ($ref->isClosure()) {
         return '*closure*';
     }
     return $ref->name . '()';
 }
开发者ID:koolkode,项目名称:aop,代码行数:10,代码来源:AbstractInterceptor.php

示例8: getLineNumber

 /**
  * @return int
  */
 public function getLineNumber()
 {
     return $this->function->isClosure() ? 0 : $this->function->getStartLine();
 }
开发者ID:phpspec,项目名称:phpspec,代码行数:7,代码来源:ExampleNode.php


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