Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

PropertyScanner.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 6.85 KiB


 001  <?php
 002  /**
 003   * Zend Framework (http://framework.zend.com/)
 004   *
 005   * @link      http://github.com/zendframework/zf2 for the canonical source repository
 006   * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
 007   * @license   http://framework.zend.com/license/new-bsd New BSD License
 008   */
 009   
 010  namespace Zend\Code\Scanner;
 011   
 012  use Zend\Code\Annotation;
 013  use Zend\Code\Exception;
 014  use Zend\Code\NameInformation;
 015   
 016  use function is_array;
 017  use function is_numeric;
 018  use function is_string;
 019  use function ltrim;
 020  use function reset;
 021  use function strpos;
 022  use function substr;
 023  use function trim;
 024  use function var_export;
 025   
 026  class PropertyScanner implements ScannerInterface
 027  {
 028      const T_BOOLEAN = 'boolean';
 029      const T_INTEGER = 'int';
 030      const T_STRING  = 'string';
 031      const T_ARRAY   = 'array';
 032      const T_UNKNOWN = 'unknown';
 033   
 034      /**
 035       * @var bool
 036       */
 037      protected $isScanned = false;
 038   
 039      /**
 040       * @var array
 041       */
 042      protected $tokens;
 043   
 044      /**
 045       * @var NameInformation
 046       */
 047      protected $nameInformation;
 048   
 049      /**
 050       * @var string
 051       */
 052      protected $class;
 053   
 054      /**
 055       * @var ClassScanner
 056       */
 057      protected $scannerClass;
 058   
 059      /**
 060       * @var int
 061       */
 062      protected $lineStart;
 063   
 064      /**
 065       * @var bool
 066       */
 067      protected $isProtected = false;
 068   
 069      /**
 070       * @var bool
 071       */
 072      protected $isPublic = true;
 073   
 074      /**
 075       * @var bool
 076       */
 077      protected $isPrivate = false;
 078   
 079      /**
 080       * @var bool
 081       */
 082      protected $isStatic = false;
 083   
 084      /**
 085       * @var string
 086       */
 087      protected $docComment;
 088   
 089      /**
 090       * @var string
 091       */
 092      protected $name;
 093   
 094      /**
 095       * @var string
 096       */
 097      protected $value;
 098   
 099      /**
 100       * @var string
 101       */
 102      protected $valueType;
 103   
 104      /**
 105       * Constructor
 106       *
 107       * @param array $propertyTokens
 108       * @param NameInformation $nameInformation
 109       */
 110      public function __construct(array $propertyTokens, NameInformation $nameInformation = null)
 111      {
 112          $this->tokens = $propertyTokens;
 113          $this->nameInformation = $nameInformation;
 114      }
 115   
 116      /**
 117       * @param string $class
 118       */
 119      public function setClass($class)
 120      {
 121          $this->class = $class;
 122      }
 123   
 124      /**
 125       * @param ClassScanner $scannerClass
 126       */
 127      public function setScannerClass(ClassScanner $scannerClass)
 128      {
 129          $this->scannerClass = $scannerClass;
 130      }
 131   
 132      /**
 133       * @return ClassScanner
 134       */
 135      public function getClassScanner()
 136      {
 137          return $this->scannerClass;
 138      }
 139   
 140      /**
 141       * @return string
 142       */
 143      public function getName()
 144      {
 145          $this->scan();
 146          return $this->name;
 147      }
 148   
 149      /**
 150       * @return string
 151       */
 152      public function getValueType()
 153      {
 154          $this->scan();
 155          return $this->valueType;
 156      }
 157   
 158      /**
 159       * @return bool
 160       */
 161      public function isPublic()
 162      {
 163          $this->scan();
 164          return $this->isPublic;
 165      }
 166   
 167      /**
 168       * @return bool
 169       */
 170      public function isPrivate()
 171      {
 172          $this->scan();
 173          return $this->isPrivate;
 174      }
 175   
 176      /**
 177       * @return bool
 178       */
 179      public function isProtected()
 180      {
 181          $this->scan();
 182          return $this->isProtected;
 183      }
 184   
 185      /**
 186       * @return bool
 187       */
 188      public function isStatic()
 189      {
 190          $this->scan();
 191          return $this->isStatic;
 192      }
 193   
 194      /**
 195       * @return string
 196       */
 197      public function getValue()
 198      {
 199          $this->scan();
 200          return $this->value;
 201      }
 202   
 203      /**
 204       * @return string
 205       */
 206      public function getDocComment()
 207      {
 208          $this->scan();
 209          return $this->docComment;
 210      }
 211   
 212      /**
 213       * @param Annotation\AnnotationManager $annotationManager
 214       * @return AnnotationScanner|false
 215       */
 216      public function getAnnotations(Annotation\AnnotationManager $annotationManager)
 217      {
 218          if (($docComment = $this->getDocComment()) == '') {
 219              return false;
 220          }
 221   
 222          return new AnnotationScanner($annotationManager, $docComment, $this->nameInformation);
 223      }
 224   
 225      /**
 226       * @return string
 227       */
 228      public function __toString()
 229      {
 230          $this->scan();
 231          return var_export($this, true);
 232      }
 233   
 234      /**
 235       * Scan tokens
 236       *
 237       * @throws \Zend\Code\Exception\RuntimeException
 238       */
 239      protected function scan()
 240      {
 241          if ($this->isScanned) {
 242              return;
 243          }
 244   
 245          if (! $this->tokens) {
 246              throw new Exception\RuntimeException('No tokens were provided');
 247          }
 248   
 249          /**
 250           * Variables & Setup
 251           */
 252          $value            = '';
 253          $concatenateValue = false;
 254   
 255          $tokens = &$this->tokens;
 256          reset($tokens);
 257   
 258          foreach ($tokens as $token) {
 259              $tempValue = $token;
 260              if (! is_string($token)) {
 261                  list($tokenType, $tokenContent, $tokenLine) = $token;
 262   
 263                  switch ($tokenType) {
 264                      case T_DOC_COMMENT:
 265                          if ($this->docComment === null && $this->name === null) {
 266                              $this->docComment = $tokenContent;
 267                          }
 268                          break;
 269   
 270                      case T_VARIABLE:
 271                          $this->name = ltrim($tokenContent, '$');
 272                          break;
 273   
 274                      case T_PUBLIC:
 275                          // use defaults
 276                          break;
 277   
 278                      case T_PROTECTED:
 279                          $this->isProtected = true;
 280                          $this->isPublic = false;
 281                          break;
 282   
 283                      case T_PRIVATE:
 284                          $this->isPrivate = true;
 285                          $this->isPublic = false;
 286                          break;
 287   
 288                      case T_STATIC:
 289                          $this->isStatic = true;
 290                          break;
 291                      default:
 292                          $tempValue = trim($tokenContent);
 293                          break;
 294                  }
 295              }
 296   
 297              //end value concatenation
 298              if (! is_array($token) && trim($token) == ';') {
 299                  $concatenateValue = false;
 300              }
 301   
 302              if (true === $concatenateValue) {
 303                  $value .= $tempValue;
 304              }
 305   
 306              //start value concatenation
 307              if (! is_array($token) && trim($token) == '=') {
 308                  $concatenateValue = true;
 309              }
 310          }
 311   
 312          $this->valueType = self::T_UNKNOWN;
 313          if ($value == 'false' || $value == 'true') {
 314              $this->valueType = self::T_BOOLEAN;
 315          } elseif (is_numeric($value)) {
 316              $this->valueType = self::T_INTEGER;
 317          } elseif (0 === strpos($value, 'array') || 0 === strpos($value, '[')) {
 318              $this->valueType = self::T_ARRAY;
 319          } elseif (0 === strpos($value, '"') || 0 === strpos($value, "'")) {
 320              $value = substr($value, 1, -1); // Remove quotes
 321              $this->valueType = self::T_STRING;
 322          }
 323   
 324          $this->value = empty($value) ? null : $value;
 325          $this->isScanned = true;
 326      }
 327  }
 328