You are here

public function ServiceManager::addClient in Backup and Migrate 5.0.x

Inject all available services into the give plugin.

Parameters

object $client:

Overrides ServiceManagerInterface::addClient

1 call to ServiceManager::addClient()
ServiceManager::add in src/Core/Service/ServiceManager.php
Add a fully configured service to the service locator.

File

src/Core/Service/ServiceManager.php, line 82

Class

ServiceManager
A very simple service locator.

Namespace

Drupal\backup_migrate\Core\Service

Code

public function addClient($client) {

  // Inject available services.
  foreach ($this
    ->keys() as $type) {
    if (method_exists($client, 'set' . $type) && ($service = $this
      ->get($type))) {

      // Save the plugin so it can be updated if this service is updated.
      $this->clients[$type][] = $client;
      $client
        ->{'set' . $type}($service);
    }
  }
}