You are here

AccountId.php in Optimizely 8.0

Same filename and directory in other branches
  1. 8 src/AccountId.php

Namespace

Drupal\optimizely

File

src/AccountId.php
View source
<?php

/**
 * @file
 * Contains \Drupal\optimizely\AccountId
 */
namespace Drupal\optimizely;

class AccountId {
  private static $config = NULL;
  private static function getConfig() {
    if (!self::$config) {
      self::$config = \Drupal::configFactory()
        ->getEditable('optimizely.settings');
    }
    return self::$config;
  }
  public static function getId() {
    $config = self::getConfig();
    $optimizely_id = $config
      ->get('optimizely_id');
    return $optimizely_id;
  }
  public static function setId($id) {
    $config = self::getConfig();
    $config
      ->set('optimizely_id', $id);
    $config
      ->save();
    return TRUE;
  }
  public static function deleteId() {

    // N.B. This deletes any and all settings
    // stored in "optimizely.settings".
    $config = self::getConfig();
    $config
      ->delete();
    return TRUE;
  }

}

Classes

Namesort descending Description
AccountId