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

Properties.php

Zuletzt modifiziert: 01.05.2026, 11:28 - Dateigröße: 4.02 KiB


 001  <?php
 002   
 003  declare(strict_types=1);
 004   
 005  namespace ProxyManager\ProxyGenerator\Util;
 006   
 007  use ReflectionClass;
 008  use ReflectionProperty;
 009   
 010  /**
 011   * DTO containing the list of all non-static proxy properties and utility methods to access them
 012   * in various formats/collections
 013   *
 014   * @author Marco Pivetta <ocramius@gmail.com>
 015   * @license MIT
 016   */
 017  final class Properties
 018  {
 019      /**
 020       * @var array|\ReflectionProperty[]
 021       */
 022      private $properties;
 023   
 024      /**
 025       * @param ReflectionProperty[] $properties
 026       */
 027      private function __construct(array $properties)
 028      {
 029          $this->properties = $properties;
 030      }
 031   
 032      public static function fromReflectionClass(ReflectionClass $reflection) : self
 033      {
 034          $class      = $reflection;
 035          $properties = [];
 036   
 037          do {
 038              $properties = array_merge(
 039                  $properties,
 040                  array_values(array_filter(
 041                      $class->getProperties(),
 042                      function (ReflectionProperty $property) use ($class) : bool {
 043                          return $class->getName() === $property->getDeclaringClass()->getName()
 044                              && ! $property->isStatic();
 045                      }
 046                  ))
 047              );
 048          } while ($class = $class->getParentClass());
 049   
 050          return new self($properties);
 051      }
 052   
 053      /**
 054       * @param string[] $excludedProperties
 055       */
 056      public function filter(array $excludedProperties) : self
 057      {
 058          $properties = $this->getInstanceProperties();
 059   
 060          foreach ($excludedProperties as $propertyName) {
 061              unset($properties[$propertyName]);
 062          }
 063   
 064          return new self($properties);
 065      }
 066   
 067      /**
 068       * @return ReflectionProperty[] indexed by the property internal visibility-aware name
 069       */
 070      public function getPublicProperties() : array
 071      {
 072          $publicProperties = [];
 073   
 074          foreach ($this->properties as $property) {
 075              if ($property->isPublic()) {
 076                  $publicProperties[$property->getName()] = $property;
 077              }
 078          }
 079   
 080          return $publicProperties;
 081      }
 082   
 083      /**
 084       * @return ReflectionProperty[] indexed by the property internal visibility-aware name (\0*\0propertyName)
 085       */
 086      public function getProtectedProperties() : array
 087      {
 088          $protectedProperties = [];
 089   
 090          foreach ($this->properties as $property) {
 091              if ($property->isProtected()) {
 092                  $protectedProperties["\0*\0" . $property->getName()] = $property;
 093              }
 094          }
 095   
 096          return $protectedProperties;
 097      }
 098   
 099      /**
 100       * @return ReflectionProperty[] indexed by the property internal visibility-aware name (\0ClassName\0propertyName)
 101       */
 102      public function getPrivateProperties() : array
 103      {
 104          $privateProperties = [];
 105   
 106          foreach ($this->properties as $property) {
 107              if ($property->isPrivate()) {
 108                  $declaringClass = $property->getDeclaringClass()->getName();
 109   
 110                  $privateProperties["\0" . $declaringClass . "\0" . $property->getName()] = $property;
 111              }
 112          }
 113   
 114          return $privateProperties;
 115      }
 116   
 117      /**
 118       * @return ReflectionProperty[] indexed by the property internal visibility-aware name (\0*\0propertyName)
 119       */
 120      public function getAccessibleProperties() : array
 121      {
 122          return array_merge($this->getPublicProperties(), $this->getProtectedProperties());
 123      }
 124   
 125      /**
 126       * @return ReflectionProperty[][] indexed by class name and property name
 127       */
 128      public function getGroupedPrivateProperties() : array
 129      {
 130          $propertiesMap = [];
 131   
 132          foreach ($this->getPrivateProperties() as $property) {
 133              $class = & $propertiesMap[$property->getDeclaringClass()->getName()];
 134   
 135              $class[$property->getName()] = $property;
 136          }
 137   
 138          return $propertiesMap;
 139      }
 140   
 141      /**
 142       * @return ReflectionProperty[] indexed by the property internal visibility-aware name (\0*\0propertyName)
 143       */
 144      public function getInstanceProperties() : array
 145      {
 146          return array_merge($this->getAccessibleProperties(), $this->getPrivateProperties());
 147      }
 148  }
 149