You are here

abstract class AbstractCachedClassLoader in X Autoload 7.4

Same name and namespace in other branches
  1. 7.5 src/ClassLoader/AbstractCachedClassLoader.php \Drupal\xautoload\ClassLoader\AbstractCachedClassLoader

Hierarchy

Expanded class hierarchy of AbstractCachedClassLoader

1 file declares its use of AbstractCachedClassLoader
XAutoloadUnitTestCase.php in lib/Drupal/xautoload/Tests/XAutoloadUnitTestCase.php

File

lib/ClassLoader/AbstractCachedClassLoader.php, line 9

Namespace

Drupal\xautoload\ClassLoader
View source
abstract class AbstractCachedClassLoader extends AbstractClassLoaderDecorator implements CacheManagerObserverInterface {

  /**
   * @var string
   */
  protected $prefix;

  /**
   * This method has side effects, so it is not the constructor.
   *
   * @param ClassFinderInterface $finder
   * @param CacheManager $cacheManager
   *
   * @return self
   *
   * @throws \Exception
   */
  static function create($finder, $cacheManager) {

    /** @var self $loader */
    $loader = new static($finder);
    if (!$loader
      ->checkRequirements()) {
      $class = get_class($loader);
      throw new CacheNotSupportedException("Unable to use {$class}, because the respetive PHP extension is not enabled.");
    }
    $cacheManager
      ->observeCachePrefix($loader);
    return $loader;
  }

  /**
   * @throws \Exception
   *   Throws an exception, if requirements are not satisfied.
   */
  protected abstract function checkRequirements();

  /**
   * {@inheritdoc}
   */
  function setCachePrefix($prefix) {
    $this->prefix = $prefix;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractCachedClassLoader::$prefix protected property
AbstractCachedClassLoader::checkRequirements abstract protected function 3
AbstractCachedClassLoader::create static function This method has side effects, so it is not the constructor.
AbstractCachedClassLoader::setCachePrefix function Set the APC prefix after a flush cache. Overrides CacheManagerObserverInterface::setCachePrefix
AbstractClassLoader::register function Registers this instance as an autoloader. Overrides ClassLoaderInterface::register
AbstractClassLoader::unregister function Unregister from the spl autoload stack. Overrides ClassLoaderInterface::unregister
AbstractClassLoaderDecorator::$finder protected property
AbstractClassLoaderDecorator::loadClass function Callback for class loading. This will include ("require") the file found. Overrides ClassLoaderInterface::loadClass 3
AbstractClassLoaderDecorator::setFinder function Replace the finder with another one.
AbstractClassLoaderDecorator::__construct protected function