Returns an Updater of the appropriate type depending on the source.
If a directory is provided which contains a module, will return a ModuleUpdater.
string $source: Directory of a Drupal project.
Drupal\Core\Updater\Updater A new Drupal\Core\Updater\Updater object.
Drupal\Core\Updater\UpdaterException
public static function factory($source) {
if (is_dir($source)) {
$updater = self::getUpdaterFromDirectory($source);
}
else {
throw new UpdaterException(t('Unable to determine the type of the source directory.'));
}
return new $updater($source);
}