class ProxyClassFinder in X Autoload 7.5
Same name and namespace in other branches
- 7.4 lib/ClassFinder/ProxyClassFinder.php \Drupal\xautoload\ClassFinder\ProxyClassFinder
A placeholder class finder. Used to postpone expensive operations until they are actually needed.
Hierarchy
- class \Drupal\xautoload\ClassLoader\AbstractClassLoader implements ClassLoaderInterface
- class \Drupal\xautoload\ClassFinder\ProxyClassFinder implements ClassFinderInterface
Expanded class hierarchy of ProxyClassFinder
2 files declare their use of ProxyClassFinder
- ServiceContainerInterface.php in src/
DIC/ ServiceContainerInterface.php - ServiceFactory.php in src/
DIC/ ServiceFactory.php
File
- src/
ClassFinder/ ProxyClassFinder.php, line 12
Namespace
Drupal\xautoload\ClassFinderView source
class ProxyClassFinder extends AbstractClassLoader implements ClassFinderInterface {
/**
* @var ExtendedClassFinderInterface
* The actual class finder.
*/
protected $finder;
/**
* @var CacheMissObserverInterface[]
* Operations to run when the actual finder is initialized.
*/
protected $cacheMissObservers = array();
/**
* @var bool
*/
protected $initialized = FALSE;
/**
* @param ExtendedClassFinderInterface $finder
*
* @internal param \Drupal\xautoload\Adapter\DrupalExtensionAdapter $helper
*/
function __construct($finder) {
$this->finder = $finder;
}
/**
* {@inheritdoc}
*/
function loadClass($class) {
$this
->initFinder();
$this->finder
->loadClass($class);
}
/**
* {@inheritdoc}
*/
function apiFindFile($api, $class) {
$this
->initFinder();
return $this->finder
->apiFindFile($api, $class);
}
/**
* @param CacheMissObserverInterface $observer
*/
function observeFirstCacheMiss($observer) {
if (!$this->initialized) {
$this->cacheMissObservers[] = $observer;
}
else {
$observer
->cacheMiss($this->finder);
}
}
/**
* @return ClassFinderInterface
*/
function getFinder() {
$this
->initFinder();
return $this->finder;
}
/**
* Initialize the finder and notify cache miss observers.
*/
protected function initFinder() {
if (!$this->initialized) {
$this->initialized = TRUE;
foreach ($this->cacheMissObservers as $operation) {
$operation
->cacheMiss($this->finder);
}
}
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AbstractClassLoader:: |
function |
Registers this instance as an autoloader. Overrides ClassLoaderInterface:: |
||
AbstractClassLoader:: |
function |
Unregister from the spl autoload stack. Overrides ClassLoaderInterface:: |
||
ProxyClassFinder:: |
protected | property | Operations to run when the actual finder is initialized. | |
ProxyClassFinder:: |
protected | property | The actual class finder. | |
ProxyClassFinder:: |
protected | property | ||
ProxyClassFinder:: |
function |
Finds the path to the file where the class is defined. Overrides ClassFinderInterface:: |
||
ProxyClassFinder:: |
function | |||
ProxyClassFinder:: |
protected | function | Initialize the finder and notify cache miss observers. | |
ProxyClassFinder:: |
function |
Callback for class loading. This will include ("require") the file found. Overrides ClassLoaderInterface:: |
||
ProxyClassFinder:: |
function | |||
ProxyClassFinder:: |
function | @internal param \Drupal\xautoload\Adapter\DrupalExtensionAdapter $helper |