當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。