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

ProxiedMethodsFilter.php

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


 01  <?php
 02   
 03  declare(strict_types=1);
 04   
 05  namespace ProxyManager\ProxyGenerator\Util;
 06   
 07  use ReflectionClass;
 08  use ReflectionMethod;
 09   
 10  /**
 11   * Utility class used to filter methods that can be proxied
 12   *
 13   * @author Marco Pivetta <ocramius@gmail.com>
 14   * @license MIT
 15   */
 16  final class ProxiedMethodsFilter
 17  {
 18      /**
 19       * @var string[]
 20       */
 21      private static $defaultExcluded = [
 22          '__get',
 23          '__set',
 24          '__isset',
 25          '__unset',
 26          '__clone',
 27          '__sleep',
 28          '__wakeup',
 29      ];
 30   
 31      /**
 32       * @param ReflectionClass $class    reflection class from which methods should be extracted
 33       * @param string[]        $excluded methods to be ignored
 34       *
 35       * @return ReflectionMethod[]
 36       */
 37      public static function getProxiedMethods(ReflectionClass $class, array $excluded = null) : array
 38      {
 39          return self::doFilter($class, (null === $excluded) ? self::$defaultExcluded : $excluded);
 40      }
 41   
 42      /**
 43       * @param ReflectionClass $class    reflection class from which methods should be extracted
 44       * @param string[]        $excluded methods to be ignored
 45       *
 46       * @return ReflectionMethod[]
 47       */
 48      public static function getAbstractProxiedMethods(ReflectionClass $class, array $excluded = null) : array
 49      {
 50          return self::doFilter($class, (null === $excluded) ? self::$defaultExcluded : $excluded, true);
 51      }
 52   
 53      /**
 54       * @param ReflectionClass $class
 55       * @param string[]        $excluded
 56       * @param bool            $requireAbstract
 57       *
 58       * @return ReflectionMethod[]
 59       */
 60      private static function doFilter(ReflectionClass $class, array $excluded, bool $requireAbstract = false) : array
 61      {
 62          $ignored = array_flip(array_map('strtolower', $excluded));
 63   
 64          return array_filter(
 65              $class->getMethods(ReflectionMethod::IS_PUBLIC),
 66              function (ReflectionMethod $method) use ($ignored, $requireAbstract) : bool {
 67                  return (! $requireAbstract || $method->isAbstract()) && ! (
 68                      \array_key_exists(strtolower($method->getName()), $ignored)
 69                      || self::methodCannotBeProxied($method)
 70                  );
 71              }
 72          );
 73      }
 74   
 75      /**
 76       * Checks whether the method cannot be proxied
 77       */
 78      private static function methodCannotBeProxied(ReflectionMethod $method) : bool
 79      {
 80          return $method->isConstructor() || $method->isFinal() || $method->isStatic();
 81      }
 82  }
 83