You are here

class Test7Config in Rocket.Chat 8.2

Same name and namespace in other branches
  1. 8 modules/rocket_chat_api/src/RocketChat/TestConfig.class.inc \Drupal\rocket_chat_api\RocketChat\Test7Config

Class Test7Config For Testing.

@package Drupal\rocket_chat_api\RocketChat

Hierarchy

Expanded class hierarchy of Test7Config

File

modules/rocket_chat_api/src/RocketChat/TestConfig.class.inc, line 17

Namespace

Drupal\rocket_chat_api\RocketChat
View source
class Test7Config extends Drupal8Config {

  /**
   * User Id.
   *
   * @var string
   *    Id.
   */
  private $userId;

  /**
   * User Token.
   *
   * @var string
   *    Secret.
   */
  private $userToken;

  /**
   * Rocket chat Server.
   *
   * @var string
   *   Server.
   */
  private $server = "http://127.0.0.1:3000";

  /**
   * {@inheritdoc}
   */
  public function getElement($elementName, $default = NULL) {
    switch ($elementName) {
      case "rocket_chat_uid":
        return $this->userId;
      case "rocket_chat_uit":
        return $this->userToken;
      case "rocket_chat_url":
        return $this->server;
      default:
        return $default;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function setElement($elementName, $newValue) {
    switch ($elementName) {
      case "rocket_chat_uid":
        $this->userId = $newValue;
        break;
      case "rocket_chat_uit":
        $this->userToken = $newValue;
        break;
      case "rocket_chat_url":
        $this->server = $newValue;
        break;
      default:
        fwrite(STDERR, "TEST SET [{$elementName}=>{$newValue}]\n");
    }
  }

  /**
   * {@inheritdoc}
   */
  public function isDebug() {
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function notify($message, $type) {
    return fwrite(STDERR, "Message [{$type}=>{$message}]\n");
  }

  /**
   * Log a specific action
   *
   * @param $message
   *   Message to log.
   * @param $level
   *   a string value if either "error"|"warning"|"info"|"debug" to indicate the level of this log message.
   *
   * @return void
   */
  public function log($message, $level) {
    self::notify($message, $level);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Drupal8Config::$config protected property The config factory.
Drupal8Config::$Logger protected property
Drupal8Config::$messenger protected property The messenger.
Drupal8Config::$moduleHandler protected property
Drupal8Config::$state protected property
Drupal8Config::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
Drupal8Config::getJsonDecoder public function Get a function pointer to the function to use for JsonDecodeing. Overrides RocketChatConfigInterface::getJsonDecoder
Drupal8Config::isReady public function Check if we got everything to connect to a Client. Overrides RocketChatConfigInterface::isReady
Drupal8Config::__construct public function Constructs a \Drupal\system\ConfigFormBase object.
Test7Config::$server private property Rocket chat Server.
Test7Config::$userId private property User Id.
Test7Config::$userToken private property User Token.
Test7Config::getElement public function Get a RocketChatConfigInterface Element. Overrides Drupal8Config::getElement
Test7Config::isDebug public function Is this a Debug / verbose Run. Overrides Drupal8Config::isDebug
Test7Config::log public function Log a specific action Overrides Drupal8Config::log
Test7Config::notify public function Notify the backend. Overrides Drupal8Config::notify
Test7Config::setElement public function Set an Element in the RocketChatConfigInterface. Overrides Drupal8Config::setElement