You are here

public static function GdprSqlBase::getInstance in General Data Protection Regulation 8.2

Same name and namespace in other branches
  1. 3.0.x modules/gdpr_dump/src/Sql/GdprSqlBase.php \Drupal\gdpr_dump\Sql\GdprSqlBase::getInstance()
1 call to GdprSqlBase::getInstance()
GdprSqlBase::create in modules/gdpr_dump/src/Sql/GdprSqlBase.php
Get a driver specific instance of this class.

File

modules/gdpr_dump/src/Sql/GdprSqlBase.php, line 66

Class

GdprSqlBase
Class GdprSqlBase.

Namespace

Drupal\gdpr_dump\Sql

Code

public static function getInstance($dbSpec, $options) {
  $driver = $dbSpec['driver'];
  $className = 'Drupal\\gdpr_dump\\Sql\\GdprSql' . ucfirst($driver);

  // @todo: Maybe add an interface, for now it's ok.

  /** @var \Drupal\gdpr_dump\Sql\GdprSqlBase $instance */

  // @todo: Maybe use classResolver.
  $instance = new $className($dbSpec, $options);

  // Inject config.
  $instance
    ->setConfig(Drush::service('config'));
  return $instance;
}