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


PHP ReflectionMethod::getPrototype方法代码示例

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


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

示例1: readMethodAnnotations

 /**
  * Reads all supported method annotations.
  *
  * @param stirng            $className
  * @param \ReflectionMethod $method
  *
  * @return array
  */
 private function readMethodAnnotations($className, \ReflectionMethod $method)
 {
     $annotations = array();
     // Read parent annotations.
     try {
         $prototype = $method->getPrototype();
         $annotations = array_merge($annotations, $this->readMethodAnnotations($className, $prototype));
     } catch (\ReflectionException $e) {
     }
     // Read method annotations.
     if ($docBlock = $method->getDocComment()) {
         $description = NULL;
         foreach (explode("\n", $docBlock) as $docLine) {
             $docLine = preg_replace('/^\\/\\*\\*\\s*|^\\s*\\*\\s*|\\s*\\*\\/$|\\s*$/', '', $docLine);
             if (preg_match('/^\\@(' . $this->availableAnnotations . ')\\s*(.*)?$/i', $docLine, $matches)) {
                 $class = $this->annotationClasses[strtolower($matches[1])];
                 $callback = array($className, $method->getName());
                 if (isset($matches[2]) && !empty($matches[2])) {
                     $annotation = new $class($callback, $matches[2]);
                 } else {
                     $annotation = new $class($callback);
                 }
                 if (NULL !== $description) {
                     $annotation->setDescription($description);
                 }
                 $annotations[] = $annotation;
             } elseif (NULL === $description && '' !== $docLine && FALSE === strpos($docLine, '@')) {
                 $description = $docLine;
             }
         }
     }
     return $annotations;
 }
开发者ID:bjeavons,项目名称:probo-test,代码行数:41,代码来源:Annotated.php

示例2: getPrototype

 /**
  * Gets the method prototype (if there is one).
  *
  * @return A `ReflectionMethod` instance of the method prototype.
  * @throws ReflectionException if the method does not have a prototype.
  */
 public function getPrototype()
 {
     /* @var \ReflectionMethod $prototype */
     /* @var \ReflectionClass $class */
     $prototype = parent::getPrototype();
     $class = $prototype->getDeclaringClass();
     return new self($class->getName(), $prototype->getName());
 }
开发者ID:mohiva,项目名称:common,代码行数:14,代码来源:ReflectionMethod.php

示例3: getPrototype

 /**
  * Returns the prototype.
  *
  * This is mostly a wrapper method, which calls the corresponding method of
  * the parent class. The only difference is that it returns an instance
  * ezcReflectionClass instead of a ReflectionClass instance
  * @return ezcReflectionClass Prototype
  * @throws ReflectionException if the method has no prototype
  */
 public function getPrototype()
 {
     if ($this->reflectionSource instanceof parent) {
         $prototype = $this->reflectionSource->getPrototype();
     } else {
         $prototype = parent::getPrototype();
     }
     return new ezcReflectionClass($prototype->getName());
 }
开发者ID:naderman,项目名称:ezc-reflection,代码行数:18,代码来源:method.php

示例4: readMethodAnnotations

 /**
  * Reads all supported method annotations.
  *
  * @param string            $className
  * @param \ReflectionMethod $method
  *
  * @return array
  */
 private function readMethodAnnotations($className, \ReflectionMethod $method)
 {
     $annotations = array();
     // read parent annotations
     try {
         $prototype = $method->getPrototype();
         // error occurs on PHP 5.4.11+ when the same trait is used by a parent and the child class
         if ($prototype->getDeclaringClass()->getName() !== $method->getDeclaringClass()->getName()) {
             $annotations = array_merge($annotations, $this->readMethodAnnotations($className, $prototype));
         }
     } catch (\ReflectionException $e) {
     }
     // read method annotations
     if ($docBlock = $method->getDocComment()) {
         $description = null;
         foreach (explode("\n", $docBlock) as $docLine) {
             $docLine = preg_replace('/^\\/\\*\\*\\s*|^\\s*\\*\\s*|\\s*\\*\\/$|\\s*$/', '', $docLine);
             if (preg_match('/^\\@(' . $this->availableAnnotations . ')\\s*(.*)?$/i', $docLine, $matches)) {
                 $class = $this->annotationClasses[strtolower($matches[1])];
                 $callback = array($className, $method->getName());
                 if (isset($matches[2]) && !empty($matches[2])) {
                     $annotation = new $class($callback, $matches[2]);
                 } else {
                     $annotation = new $class($callback);
                 }
                 if (null !== $description) {
                     $annotation->setDescription($description);
                 }
                 $annotations[] = $annotation;
             } elseif (null === $description && '' !== $docLine && false === strpos($docLine, '@')) {
                 $description = $docLine;
             }
         }
     }
     return $annotations;
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:44,代码来源:AnnotatedLoader.php

示例5: getPrototype

 /**
  * @return Method
  */
 public function getPrototype()
 {
     $prototype = parent::getPrototype();
     return new Method($prototype->getDeclaringClass()->getName(), $prototype->getName());
 }
开发者ID:rostenkowski,项目名称:nette,代码行数:8,代码来源:Method.php

示例6: getInheritDoc

 /**
  * @param \ReflectionMethod $reflectionMethod
  * @return DocBlock
  */
 protected function getInheritDoc($reflectionMethod)
 {
     $parentClass = $reflectionMethod->getDeclaringClass()->getParentClass();
     //Get either a parent or the interface
     if ($parentClass) {
         $method = $parentClass->getMethod($reflectionMethod->getName());
     } else {
         $method = $reflectionMethod->getPrototype();
     }
     if ($method) {
         $namespace = $method->getDeclaringClass()->getNamespaceName();
         $phpdoc = new DocBlock($method, new Context($namespace));
         if (strpos($phpdoc->getText(), '{@inheritdoc}') !== false) {
             //Not at the end yet, try another parent/interface..
             return $this->getInheritDoc($method);
         } else {
             return $phpdoc;
         }
     }
 }
开发者ID:aamirchaudhary,项目名称:laravel-ide-helper,代码行数:24,代码来源:Method.php

示例7: getPrototype

 function getPrototype()
 {
     $prototype = parent::getPrototype();
     return new NMethodReflection($prototype->getDeclaringClass()->getName(), $prototype->getName());
 }
开发者ID:kacer,项目名称:FakturoidPairing,代码行数:5,代码来源:nette.php

示例8: getPrototype

 /**
  * Returns the method prototype.
  *
  * @return \TokenReflection\Php\ReflectionMethod
  */
 public function getPrototype()
 {
     return self::create(parent::getPrototype(), $this->broker);
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:9,代码来源:ReflectionMethod.php

示例9: isImplementMethod

 /**
  * Returns whether the method is implement method.
  *
  * @param \ReflectionMethod $method          ReflectionMethod object.
  * @param \ReflectionClass  &$declaringClass Output parameter for Declaring class.
  * @return bool true if the method is implement method, false otherwise.
  */
 protected function isImplementMethod(\ReflectionMethod $method, &$declaringClass)
 {
     try {
         $declaringClass = $method->getPrototype()->getDeclaringClass();
         if ($declaringClass->isInterface()) {
             return true;
         }
         if ($declaringClass->getMethod($method->getName())->isAbstract()) {
             return true;
         }
         return false;
     } catch (\ReflectionException $e) {
         return null;
     }
 }
开发者ID:satooshi,项目名称:object-inspector,代码行数:22,代码来源:ObjectMethodInspector.php


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