class ProxyClassFinder in X Autoload 7.4
Same name and namespace in other branches
- 7.5 src/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 lib/
DIC/ ServiceContainerInterface.php - ServiceFactory.php in lib/
DIC/ ServiceFactory.php
File
- lib/
ClassFinder/ ProxyClassFinder.php, line 13
Namespace
Drupal\xautoload\ClassFinderView source
class ProxyClassFinder extends AbstractClassLoader implements ClassFinderInterface {
/**
* @var ExtendedClassFinderInterface
* The actual class finder.
*/
protected $finder;
/**
* @var DrupalExtensionAdapter
*/
protected $helper;
/**
* @var FinderOperationInterface[]
* Operations to run when the actual finder is initialized.
*/
protected $scheduledOperations = array();
/**
* @var bool
*/
protected $initialized = FALSE;
/**
* @param ExtendedClassFinderInterface $finder
* @param DrupalExtensionAdapter $helper
*/
function __construct($finder, $helper) {
$this->finder = $finder;
$this->helper = $helper;
}
/**
* {@inheritdoc}
*/
function loadClass($class) {
$this
->initFinder();
$this->finder
->loadClass($class);
}
/**
* {@inheritdoc}
*/
function apiFindFile($api, $class) {
$this
->initFinder();
return $this->finder
->apiFindFile($api, $class);
}
/**
* @param FinderOperationInterface $operation
*/
function onFinderInit($operation) {
if (!$this->initialized) {
$this->scheduledOperations[] = $operation;
}
else {
$operation
->operateOnFinder($this->finder, $this->helper);
}
}
/**
* @return ClassFinderInterface
*/
function getFinder() {
$this
->initFinder();
return $this->finder;
}
/**
* Initialize the finder and run scheduled operations.
*/
protected function initFinder() {
if (!$this->initialized) {
foreach ($this->scheduledOperations as $operation) {
$operation
->operateOnFinder($this->finder, $this->helper);
}
$this->initialized = TRUE;
}
}
}
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 | The actual class finder. | |
ProxyClassFinder:: |
protected | property | ||
ProxyClassFinder:: |
protected | property | ||
ProxyClassFinder:: |
protected | property | Operations to run when the actual finder is initialized. | |
ProxyClassFinder:: |
function |
Finds the path to the file where the class is defined. Overrides ClassFinderInterface:: |
||
ProxyClassFinder:: |
function | |||
ProxyClassFinder:: |
protected | function | Initialize the finder and run scheduled operations. | |
ProxyClassFinder:: |
function |
Callback for class loading. This will include ("require") the file found. Overrides ClassLoaderInterface:: |
||
ProxyClassFinder:: |
function | |||
ProxyClassFinder:: |
function |