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


PHP ReflectionFunctionAbstract::isUserDefined方法代码示例

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


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

示例1: __construct

 /**
  * Constructs a FunctionParser from a reflected function. Triggers all code parsing from the constructor.
  *
  * @param \ReflectionFunctionAbstract $reflection The reflected function or method.
  */
 public function __construct(\ReflectionFunctionAbstract $reflection)
 {
     if (!$reflection->isUserDefined()) {
         throw new \InvalidArgumentException('You can only parse the code of user-defined functions.');
     }
     $this->reflection = $reflection;
     $this->tokenizer = $this->fetchTokenizer();
     $this->parameters = $this->fetchParameters();
     $this->code = $this->parseCode();
     $this->body = $this->parseBody();
     $this->context = $this->parseContext();
 }
开发者ID:jeremeamia,项目名称:functionparser,代码行数:17,代码来源:FunctionParser.php

示例2: LoadSourceLines

 private function LoadSourceLines(\ReflectionFunctionAbstract $Reflection)
 {
     if (!$Reflection->isUserDefined()) {
         throw new Functional\FunctionException('Cannot parse function: Function must be user defined');
     }
     $FileName = $Reflection->getFileName();
     if (!file_exists($FileName)) {
         throw new Functional\FunctionException('Cannot parse function: Function does not belong to a valid file (cannot be eval\'d code)');
     }
     $SourceLines = [];
     $File = new \SplFileObject($Reflection->getFileName());
     $StartLine = $Reflection->getStartLine() - 2;
     $File->seek($StartLine);
     $EndLine = $Reflection->getEndLine() - 2;
     while ($File->key() <= $EndLine) {
         $SourceLines[] = trim($File->fgets());
     }
     unset($File);
     $FirstLine =& $SourceLines[0];
     $FirstLine = substr($FirstLine, stripos($FirstLine, 'function'));
     $LastLine =& $SourceLines[count($SourceLines) - 1];
     $LastLine = substr($LastLine, 0, strrpos($LastLine, '}') + 1);
     return array_filter($SourceLines);
 }
开发者ID:timetoogo,项目名称:penumbra,代码行数:24,代码来源:Reader.php

示例3: __construct

 /**
  * Constructor.
  *
  * @param string|array                $function  Defining function/method
  * @param string                      $paramName Parameter name
  * @param \TokenReflection\Broker     $broker    Reflection broker
  * @param \ReflectionFunctionAbstract $parent    Parent reflection object
  */
 public function __construct($function, $paramName, Broker $broker, InternalReflectionFunctionAbstract $parent)
 {
     parent::__construct($function, $paramName);
     $this->broker = $broker;
     $this->userDefined = $parent->isUserDefined();
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:14,代码来源:ReflectionParameter.php


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