class AcquiaPurgeExecutorsService in Acquia Purge 7
Service that loads and provides access to executor backends.
Hierarchy
- class \AcquiaPurgeExecutorsService implements \Iterator
Expanded class hierarchy of AcquiaPurgeExecutorsService
File
- lib/
executor/ AcquiaPurgeExecutorsService.php, line 11 - Contains AcquiaPurgeExecutorsService.
View source
class AcquiaPurgeExecutorsService implements \Iterator {
/**
* Core executor backends that always run regardless what.
*
* @var string[]
*/
protected $core_backends = array(
'_acquia_purge_executor_page_cache',
'_acquia_purge_executor_acquia',
);
/**
* The loaded backends.
*
* @var AcquiaPurgeExecutorInterface
*/
protected $executors = array();
/**
* Current iterator position.
*
* @var int
*/
protected $position = 0;
/**
* The Acquia Purge service object.
*
* @var AcquiaPurgeService
*/
protected $service;
/**
* Construct a new AcquiaPurgeExecutorsService instance.
*
* @param AcquiaPurgeService $service
* The Acquia Purge service object.
*/
public function __construct(AcquiaPurgeService $service) {
$this->service = $service;
_acquia_purge_load('_acquia_purge_executor_interface');
_acquia_purge_load('_acquia_purge_executor_base');
foreach ($this
->getRegisteredBackends() as $service_or_path) {
$class = _acquia_purge_load($service_or_path);
if ($class::isEnabled($this->service)) {
$instance = new $class($this->service);
if (!$instance instanceof AcquiaPurgeExecutorInterface) {
throw new \RuntimeException("{$class} != AcquiaPurgeExecutorInterface");
}
$this->executors[] = $instance;
}
}
}
/**
* {@inheritdoc}
*/
public function current() {
if ($this
->valid()) {
return $this->executors[$this->position];
}
return FALSE;
}
/**
* Retrieve all loadable backends.
*
* @return string[]
* List of paths or _acquia_purge_load() service names.
*/
protected function getRegisteredBackends() {
$external_backends = array();
foreach (module_implements('acquia_purge_executors') as $module) {
$function = $module . '_acquia_purge_executors';
$function($external_backends);
}
return array_merge($this->core_backends, $external_backends);
}
/**
* {@inheritdoc}
*/
public function key() {
return $this->position;
}
/**
* {@inheritdoc}
*/
public function next() {
++$this->position;
}
/**
* {@inheritdoc}
*/
public function rewind() {
$this->position = 0;
}
/**
* {@inheritdoc}
*/
public function valid() {
return isset($this->executors[$this->position]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AcquiaPurgeExecutorsService:: |
protected | property | Core executor backends that always run regardless what. | |
AcquiaPurgeExecutorsService:: |
protected | property | The loaded backends. | |
AcquiaPurgeExecutorsService:: |
protected | property | Current iterator position. | |
AcquiaPurgeExecutorsService:: |
protected | property | The Acquia Purge service object. | |
AcquiaPurgeExecutorsService:: |
public | function | ||
AcquiaPurgeExecutorsService:: |
protected | function | Retrieve all loadable backends. | |
AcquiaPurgeExecutorsService:: |
public | function | ||
AcquiaPurgeExecutorsService:: |
public | function | ||
AcquiaPurgeExecutorsService:: |
public | function | ||
AcquiaPurgeExecutorsService:: |
public | function | ||
AcquiaPurgeExecutorsService:: |
public | function | Construct a new AcquiaPurgeExecutorsService instance. |