[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/zendframework/zend-code/src/Reflection/ -> PropertyReflection.php (source)

   1  <?php
   2  /**
   3   * Zend Framework (http://framework.zend.com/)
   4   *
   5   * @link      http://github.com/zendframework/zf2 for the canonical source repository
   6   * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
   7   * @license   http://framework.zend.com/license/new-bsd New BSD License
   8   */
   9  
  10  namespace Zend\Code\Reflection;
  11  
  12  use ReflectionProperty as PhpReflectionProperty;
  13  use Zend\Code\Annotation\AnnotationManager;
  14  use Zend\Code\Scanner\AnnotationScanner;
  15  use Zend\Code\Scanner\CachingFileScanner;
  16  
  17  /**
  18   * @todo       implement line numbers
  19   */
  20  class PropertyReflection extends PhpReflectionProperty implements ReflectionInterface
  21  {
  22      /**
  23       * @var AnnotationScanner
  24       */
  25      protected $annotations;
  26  
  27      /**
  28       * Get declaring class reflection object
  29       *
  30       * @return ClassReflection
  31       */
  32      public function getDeclaringClass()
  33      {
  34          $phpReflection  = parent::getDeclaringClass();
  35          $zendReflection = new ClassReflection($phpReflection->getName());
  36          unset($phpReflection);
  37  
  38          return $zendReflection;
  39      }
  40  
  41      /**
  42       * Get DocBlock comment
  43       *
  44       * @return string|false False if no DocBlock defined
  45       */
  46      public function getDocComment()
  47      {
  48          return parent::getDocComment();
  49      }
  50  
  51      /**
  52       * @return false|DocBlockReflection
  53       */
  54      public function getDocBlock()
  55      {
  56          if (! ($docComment = $this->getDocComment())) {
  57              return false;
  58          }
  59  
  60          $docBlockReflection = new DocBlockReflection($docComment);
  61  
  62          return $docBlockReflection;
  63      }
  64  
  65      /**
  66       * @param  AnnotationManager $annotationManager
  67       * @return AnnotationScanner|false
  68       */
  69      public function getAnnotations(AnnotationManager $annotationManager)
  70      {
  71          if (null !== $this->annotations) {
  72              return $this->annotations;
  73          }
  74  
  75          if (($docComment = $this->getDocComment()) == '') {
  76              return false;
  77          }
  78  
  79          $class              = $this->getDeclaringClass();
  80          $cachingFileScanner = $this->createFileScanner($class->getFileName());
  81          $nameInformation    = $cachingFileScanner->getClassNameInformation($class->getName());
  82  
  83          if (! $nameInformation) {
  84              return false;
  85          }
  86  
  87          $this->annotations  = new AnnotationScanner($annotationManager, $docComment, $nameInformation);
  88  
  89          return $this->annotations;
  90      }
  91  
  92      /**
  93       * @return string
  94       */
  95      public function toString()
  96      {
  97          return $this->__toString();
  98      }
  99  
 100      /**
 101       * Creates a new FileScanner instance.
 102       *
 103       * By having this as a separate method it allows the method to be overridden
 104       * if a different FileScanner is needed.
 105       *
 106       * @param  string $filename
 107       *
 108       * @return CachingFileScanner
 109       */
 110      protected function createFileScanner($filename)
 111      {
 112          return new CachingFileScanner($filename);
 113      }
 114  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1