You are here

public function InMemoryConfig::getElement in Rocket.Chat 8

Same name and namespace in other branches
  1. 8.2 modules/rocket_chat_api/src/RocketChat/InMemoryConfig.php \Drupal\rocket_chat_api\RocketChat\InMemoryConfig::getElement()

Get a RocketChatConfigInterface Element.

Parameters

string $elementName: Key value to retrieve from the RocketChatConfigInterface Backend.

string $default: A possible Default to use when no config is found in the backend.

Return value

mixed The retrieved config value.

Overrides RocketChatConfigInterface::getElement

File

modules/rocket_chat_api/src/RocketChat/InMemoryConfig.php, line 98

Class

InMemoryConfig
Class InMemoryConfig keeps the config in memory.

Namespace

Drupal\rocket_chat_api\RocketChat

Code

public function getElement($elementName, $default = NULL) {
  switch ($elementName) {
    case 'rocket_chat_url':
    case 'server':
      return $this->url;
    case 'rocket_chat_uid':
      return $this->uid;
    case 'rocket_chat_uit':
      return $this->utk;
    default:
      throw new \InvalidArgumentException("[{$elementName}] not found", 144);
  }
}