You are here

static function AbstractCachedClassLoader::create in X Autoload 7.5

Same name and namespace in other branches
  1. 7.4 lib/ClassLoader/AbstractCachedClassLoader.php \Drupal\xautoload\ClassLoader\AbstractCachedClassLoader::create()

This method has side effects, so it is not the constructor.

Parameters

ClassFinderInterface $finder:

CacheManager $cacheManager:

Return value

self

Throws

\Exception

File

src/ClassLoader/AbstractCachedClassLoader.php, line 28

Class

AbstractCachedClassLoader

Namespace

Drupal\xautoload\ClassLoader

Code

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;
}