[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

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

   1  <?php
   2  
   3  declare(strict_types=1);
   4  
   5  namespace ProxyManager\Autoloader;
   6  
   7  use ProxyManager\FileLocator\FileLocatorInterface;
   8  use ProxyManager\Inflector\ClassNameInflectorInterface;
   9  
  10  /**
  11   * {@inheritDoc}
  12   *
  13   * @author Marco Pivetta <ocramius@gmail.com>
  14   * @license MIT
  15   */
  16  class Autoloader implements AutoloaderInterface
  17  {
  18      /**
  19       * @var \ProxyManager\FileLocator\FileLocatorInterface
  20       */
  21      protected $fileLocator;
  22  
  23      /**
  24       * @var \ProxyManager\Inflector\ClassNameInflectorInterface
  25       */
  26      protected $classNameInflector;
  27  
  28      /**
  29       * @param \ProxyManager\FileLocator\FileLocatorInterface      $fileLocator
  30       * @param \ProxyManager\Inflector\ClassNameInflectorInterface $classNameInflector
  31       */
  32      public function __construct(FileLocatorInterface $fileLocator, ClassNameInflectorInterface $classNameInflector)
  33      {
  34          $this->fileLocator        = $fileLocator;
  35          $this->classNameInflector = $classNameInflector;
  36      }
  37  
  38      /**
  39       * {@inheritDoc}
  40       */
  41      public function __invoke(string $className) : bool
  42      {
  43          if (class_exists($className, false) || ! $this->classNameInflector->isProxyClassName($className)) {
  44              return false;
  45          }
  46  
  47          $file = $this->fileLocator->getProxyFileName($className);
  48  
  49          if (! file_exists($file)) {
  50              return false;
  51          }
  52  
  53          /* @noinspection PhpIncludeInspection */
  54          /* @noinspection UsingInclusionOnceReturnValueInspection */
  55          return (bool) require_once $file;
  56      }
  57  }


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