[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/ -> InvalidProxiedClassException.php (source)

   1  <?php
   2  
   3  declare(strict_types=1);
   4  
   5  namespace ProxyManager\Exception;
   6  
   7  use InvalidArgumentException;
   8  use ReflectionClass;
   9  use ReflectionMethod;
  10  
  11  /**
  12   * Exception for invalid proxied classes
  13   *
  14   * @author Marco Pivetta <ocramius@gmail.com>
  15   * @license MIT
  16   */
  17  class InvalidProxiedClassException extends InvalidArgumentException implements ExceptionInterface
  18  {
  19      public static function interfaceNotSupported(ReflectionClass $reflection) : self
  20      {
  21          return new self(sprintf('Provided interface "%s" cannot be proxied', $reflection->getName()));
  22      }
  23  
  24      public static function finalClassNotSupported(ReflectionClass $reflection) : self
  25      {
  26          return new self(sprintf('Provided class "%s" is final and cannot be proxied', $reflection->getName()));
  27      }
  28  
  29      public static function abstractProtectedMethodsNotSupported(ReflectionClass $reflection) : self
  30      {
  31          return new self(sprintf(
  32              'Provided class "%s" has following protected abstract methods, and therefore cannot be proxied:' . "\n%s",
  33              $reflection->getName(),
  34              implode(
  35                  "\n",
  36                  array_map(
  37                      function (ReflectionMethod $reflectionMethod) : string {
  38                          return $reflectionMethod->getDeclaringClass()->getName() . '::' . $reflectionMethod->getName();
  39                      },
  40                      array_filter(
  41                          $reflection->getMethods(),
  42                          function (ReflectionMethod $method) : bool {
  43                              return $method->isAbstract() && $method->isProtected();
  44                          }
  45                      )
  46                  )
  47              )
  48          ));
  49      }
  50  }


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