You are here

class Storage in Acquia Connector 8

Same name and namespace in other branches
  1. 8.2 src/Helper/Storage.php \Drupal\acquia_connector\Helper\Storage
  2. 3.x src/Helper/Storage.php \Drupal\acquia_connector\Helper\Storage

Class Storage.

Single centralized place for accessing and updating Acquia Connector settings. All currently existing configs should be moved here and use Drupal State API instead of Drupal Config. For more info visit https://www.drupal.org/node/2635138.

Hierarchy

  • class \Drupal\acquia_connector\Helper\Storage

Expanded class hierarchy of Storage

16 files declare their use of Storage
AcquiaConnectorModuleTest.php in tests/src/Functional/AcquiaConnectorModuleTest.php
AcquiaConnectorSearchOverrideTest.php in acquia_search/tests/src/Functional/AcquiaConnectorSearchOverrideTest.php
AcquiaSearchOverrideTest.php in acquia_search/tests/src/Kernel/AcquiaSearchOverrideTest.php
acquia_connector.install in ./acquia_connector.install
Install, update, and uninstall functions for the Acquia Connector module.
acquia_connector.module in ./acquia_connector.module
Acquia Connector module.

... See full list

File

src/Helper/Storage.php, line 13

Namespace

Drupal\acquia_connector\Helper
View source
class Storage {

  /**
   * Returns Acquia Subscription identifier.
   *
   * @return mixed
   *   Acquia Subscription identifier.
   */
  public function getIdentifier() {
    return \Drupal::state()
      ->get('acquia_connector.identifier');
  }

  /**
   * Returns Acquia Subscription key.
   *
   * @return mixed
   *   Acquia Subscription key.
   */
  public function getKey() {
    return \Drupal::state()
      ->get('acquia_connector.key');
  }

  /**
   * Updates Acquia Subscription identifier.
   *
   * @param string $value
   *   Acquia Subscription identifier.
   */
  public function setIdentifier($value) {
    \Drupal::state()
      ->set('acquia_connector.identifier', $value);
  }

  /**
   * Updates Acquia Subscription key.
   *
   * @param string $value
   *   Acquia Subscription key.
   */
  public function setKey($value) {
    \Drupal::state()
      ->set('acquia_connector.key', $value);
  }

  /**
   * Deletes all stored data.
   */
  public function deleteAllData() {
    \Drupal::state()
      ->deleteMultiple([
      'acquia_connector.key',
      'acquia_connector.identifier',
      'spi.site_name',
      'spi.site_machine_name',
    ]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Storage::deleteAllData public function Deletes all stored data.
Storage::getIdentifier public function Returns Acquia Subscription identifier.
Storage::getKey public function Returns Acquia Subscription key.
Storage::setIdentifier public function Updates Acquia Subscription identifier.
Storage::setKey public function Updates Acquia Subscription key.