You are here

public function AcquiaPurgeExecutorsService::__construct in Acquia Purge 7

Construct a new AcquiaPurgeExecutorsService instance.

Parameters

AcquiaPurgeService $service: The Acquia Purge service object.

File

lib/executor/AcquiaPurgeExecutorsService.php, line 50
Contains AcquiaPurgeExecutorsService.

Class

AcquiaPurgeExecutorsService
Service that loads and provides access to executor backends.

Code

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