public function ServiceManager::addClient in Backup and Migrate 8.4
Inject all available services into the give plugin.
Parameters
object $client:
Return value
mixed|void
Overrides ServiceManagerInterface::addClient
1 call to ServiceManager::addClient()
- ServiceManager::add in lib/
backup_migrate_core/ src/ Service/ ServiceManager.php - Add a fully configured service to the service locator.
File
- lib/
backup_migrate_core/ src/ Service/ ServiceManager.php, line 86
Class
- ServiceManager
- A very simple service locator. Does not handle dependency injection but could be replaced by a more complex application specific version which does.
Namespace
BackupMigrate\Core\ServiceCode
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);
}
}
}