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

DerivedClassScanner.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 10.04 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\Exception;
 013   
 014  use function array_keys;
 015  use function array_merge;
 016  use function sprintf;
 017  use function trigger_error;
 018   
 019  class DerivedClassScanner extends ClassScanner
 020  {
 021      /**
 022       * @var DirectoryScanner
 023       */
 024      protected $directoryScanner;
 025   
 026      /**
 027       * @var ClassScanner
 028       */
 029      protected $classScanner;
 030   
 031      /**
 032       * @var array
 033       */
 034      protected $parentClassScanners = [];
 035   
 036      /**
 037       * @var array
 038       */
 039      protected $interfaceClassScanners = [];
 040   
 041      /**
 042       * @param ClassScanner $classScanner
 043       * @param DirectoryScanner $directoryScanner
 044       */
 045      public function __construct(ClassScanner $classScanner, DirectoryScanner $directoryScanner)
 046      {
 047          $this->classScanner     = $classScanner;
 048          $this->directoryScanner = $directoryScanner;
 049   
 050          $currentScannerClass = $classScanner;
 051   
 052          while ($currentScannerClass && $currentScannerClass->hasParentClass()) {
 053              $currentParentClassName = $currentScannerClass->getParentClass();
 054              if ($directoryScanner->hasClass($currentParentClassName)) {
 055                  $currentParentClass = $directoryScanner->getClass($currentParentClassName);
 056                  $this->parentClassScanners[$currentParentClassName] = $currentParentClass;
 057                  $currentScannerClass = $currentParentClass;
 058              } else {
 059                  $currentScannerClass = false;
 060              }
 061          }
 062   
 063          foreach ($interfaces = $this->classScanner->getInterfaces() as $iName) {
 064              if ($directoryScanner->hasClass($iName)) {
 065                  $this->interfaceClassScanners[$iName] = $directoryScanner->getClass($iName);
 066              }
 067          }
 068      }
 069   
 070      /**
 071       * @return null|string
 072       */
 073      public function getName()
 074      {
 075          return $this->classScanner->getName();
 076      }
 077   
 078      /**
 079       * @return null|string
 080       */
 081      public function getShortName()
 082      {
 083          return $this->classScanner->getShortName();
 084      }
 085   
 086      /**
 087       * @return bool
 088       */
 089      public function isInstantiable()
 090      {
 091          return $this->classScanner->isInstantiable();
 092      }
 093   
 094      /**
 095       * @return bool
 096       */
 097      public function isFinal()
 098      {
 099          return $this->classScanner->isFinal();
 100      }
 101   
 102      /**
 103       * @return bool
 104       */
 105      public function isAbstract()
 106      {
 107          return $this->classScanner->isAbstract();
 108      }
 109   
 110      /**
 111       * @return bool
 112       */
 113      public function isInterface()
 114      {
 115          return $this->classScanner->isInterface();
 116      }
 117   
 118      /**
 119       * @return array
 120       */
 121      public function getParentClasses()
 122      {
 123          return array_keys($this->parentClassScanners);
 124      }
 125   
 126      /**
 127       * @return bool
 128       */
 129      public function hasParentClass()
 130      {
 131          return $this->classScanner->getParentClass() !== null;
 132      }
 133   
 134      /**
 135       * @return null|string
 136       */
 137      public function getParentClass()
 138      {
 139          return $this->classScanner->getParentClass();
 140      }
 141   
 142      /**
 143       * @param  bool $returnClassScanners
 144       * @return array
 145       */
 146      public function getInterfaces($returnClassScanners = false)
 147      {
 148          if ($returnClassScanners) {
 149              return $this->interfaceClassScanners;
 150          }
 151   
 152          $interfaces = $this->classScanner->getInterfaces();
 153          foreach ($this->parentClassScanners as $pClassScanner) {
 154              $interfaces = array_merge($interfaces, $pClassScanner->getInterfaces());
 155          }
 156   
 157          return $interfaces;
 158      }
 159   
 160      /**
 161       * Return a list of constant names
 162       *
 163       * @return array
 164       */
 165      public function getConstantNames()
 166      {
 167          $constants = $this->classScanner->getConstantNames();
 168          foreach ($this->parentClassScanners as $pClassScanner) {
 169              $constants = array_merge($constants, $pClassScanner->getConstantNames());
 170          }
 171   
 172          return $constants;
 173      }
 174   
 175      /**
 176       * Return a list of constants
 177       *
 178       * @param  bool $namesOnly Set false to return instances of ConstantScanner
 179       * @return array|ConstantScanner[]
 180       */
 181      public function getConstants($namesOnly = true)
 182      {
 183          if (true === $namesOnly) {
 184              trigger_error('Use method getConstantNames() instead', E_USER_DEPRECATED);
 185              return $this->getConstantNames();
 186          }
 187   
 188          $constants = $this->classScanner->getConstants();
 189          foreach ($this->parentClassScanners as $pClassScanner) {
 190              $constants = array_merge($constants, $pClassScanner->getConstants($namesOnly));
 191          }
 192   
 193          return $constants;
 194      }
 195   
 196      /**
 197       * Return a single constant by given name or index of info
 198       *
 199       * @param  string|int $constantNameOrInfoIndex
 200       * @throws Exception\InvalidArgumentException
 201       * @return bool|ConstantScanner
 202       */
 203      public function getConstant($constantNameOrInfoIndex)
 204      {
 205          if ($this->classScanner->hasConstant($constantNameOrInfoIndex)) {
 206              return $this->classScanner->getConstant($constantNameOrInfoIndex);
 207          }
 208   
 209          foreach ($this->parentClassScanners as $pClassScanner) {
 210              if ($pClassScanner->hasConstant($constantNameOrInfoIndex)) {
 211                  return $pClassScanner->getConstant($constantNameOrInfoIndex);
 212              }
 213          }
 214   
 215          throw new Exception\InvalidArgumentException(sprintf(
 216              'Constant %s not found in %s',
 217              $constantNameOrInfoIndex,
 218              $this->classScanner->getName()
 219          ));
 220      }
 221   
 222      /**
 223       * Verify if class or parent class has constant
 224       *
 225       * @param  string $name
 226       * @return bool
 227       */
 228      public function hasConstant($name)
 229      {
 230          if ($this->classScanner->hasConstant($name)) {
 231              return true;
 232          }
 233          foreach ($this->parentClassScanners as $pClassScanner) {
 234              if ($pClassScanner->hasConstant($name)) {
 235                  return true;
 236              }
 237          }
 238   
 239          return false;
 240      }
 241   
 242      /**
 243       * Return a list of property names
 244       *
 245       * @return array
 246       */
 247      public function getPropertyNames()
 248      {
 249          $properties = $this->classScanner->getPropertyNames();
 250          foreach ($this->parentClassScanners as $pClassScanner) {
 251              $properties = array_merge($properties, $pClassScanner->getPropertyNames());
 252          }
 253   
 254          return $properties;
 255      }
 256   
 257      /**
 258       * @param  bool $returnScannerProperty
 259       * @return array
 260       */
 261      public function getProperties($returnScannerProperty = false)
 262      {
 263          $properties = $this->classScanner->getProperties($returnScannerProperty);
 264          foreach ($this->parentClassScanners as $pClassScanner) {
 265              $properties = array_merge($properties, $pClassScanner->getProperties($returnScannerProperty));
 266          }
 267   
 268          return $properties;
 269      }
 270   
 271      /**
 272       * Return a single property by given name or index of info
 273       *
 274       * @param  string|int $propertyNameOrInfoIndex
 275       * @throws Exception\InvalidArgumentException
 276       * @return bool|PropertyScanner
 277       */
 278      public function getProperty($propertyNameOrInfoIndex)
 279      {
 280          if ($this->classScanner->hasProperty($propertyNameOrInfoIndex)) {
 281              return $this->classScanner->getProperty($propertyNameOrInfoIndex);
 282          }
 283   
 284          foreach ($this->parentClassScanners as $pClassScanner) {
 285              if ($pClassScanner->hasProperty($propertyNameOrInfoIndex)) {
 286                  return $pClassScanner->getProperty($propertyNameOrInfoIndex);
 287              }
 288          }
 289   
 290          throw new Exception\InvalidArgumentException(sprintf(
 291              'Property %s not found in %s',
 292              $propertyNameOrInfoIndex,
 293              $this->classScanner->getName()
 294          ));
 295      }
 296   
 297      /**
 298       * Verify if class or parent class has property
 299       *
 300       * @param  string $name
 301       * @return bool
 302       */
 303      public function hasProperty($name)
 304      {
 305          if ($this->classScanner->hasProperty($name)) {
 306              return true;
 307          }
 308          foreach ($this->parentClassScanners as $pClassScanner) {
 309              if ($pClassScanner->hasProperty($name)) {
 310                  return true;
 311              }
 312          }
 313   
 314          return false;
 315      }
 316   
 317      /**
 318       * @return array
 319       */
 320      public function getMethodNames()
 321      {
 322          $methods = $this->classScanner->getMethodNames();
 323          foreach ($this->parentClassScanners as $pClassScanner) {
 324              $methods = array_merge($methods, $pClassScanner->getMethodNames());
 325          }
 326   
 327          return $methods;
 328      }
 329   
 330      /**
 331       * @return MethodScanner[]
 332       */
 333      public function getMethods()
 334      {
 335          $methods = $this->classScanner->getMethods();
 336          foreach ($this->parentClassScanners as $pClassScanner) {
 337              $methods = array_merge($methods, $pClassScanner->getMethods());
 338          }
 339   
 340          return $methods;
 341      }
 342   
 343      /**
 344       * @param  int|string $methodNameOrInfoIndex
 345       * @return MethodScanner
 346       * @throws Exception\InvalidArgumentException
 347       */
 348      public function getMethod($methodNameOrInfoIndex)
 349      {
 350          if ($this->classScanner->hasMethod($methodNameOrInfoIndex)) {
 351              return $this->classScanner->getMethod($methodNameOrInfoIndex);
 352          }
 353   
 354          foreach ($this->parentClassScanners as $pClassScanner) {
 355              if ($pClassScanner->hasMethod($methodNameOrInfoIndex)) {
 356                  return $pClassScanner->getMethod($methodNameOrInfoIndex);
 357              }
 358          }
 359   
 360          throw new Exception\InvalidArgumentException(sprintf(
 361              'Method %s not found in %s',
 362              $methodNameOrInfoIndex,
 363              $this->classScanner->getName()
 364          ));
 365      }
 366   
 367      /**
 368       * Verify if class or parent class has method by given name
 369       *
 370       * @param  string $name
 371       * @return bool
 372       */
 373      public function hasMethod($name)
 374      {
 375          if ($this->classScanner->hasMethod($name)) {
 376              return true;
 377          }
 378          foreach ($this->parentClassScanners as $pClassScanner) {
 379              if ($pClassScanner->hasMethod($name)) {
 380                  return true;
 381              }
 382          }
 383   
 384          return false;
 385      }
 386  }
 387