class InMemoryConfig in Rocket.Chat 8
Same name and namespace in other branches
- 8.2 modules/rocket_chat_api/src/RocketChat/InMemoryConfig.php \Drupal\rocket_chat_api\RocketChat\InMemoryConfig
Class InMemoryConfig keeps the config in memory.
@package RocketChat
Hierarchy
- class \Drupal\rocket_chat_api\RocketChat\InMemoryConfig implements RocketChatConfigInterface
Expanded class hierarchy of InMemoryConfig
1 file declares its use of InMemoryConfig
File
- modules/
rocket_chat_api/ src/ RocketChat/ InMemoryConfig.php, line 17
Namespace
Drupal\rocket_chat_api\RocketChatView source
class InMemoryConfig implements RocketChatConfigInterface {
/**
* Server URL.
*
* @var string
* Store's the Server URL.
*/
private $url;
/**
* User name.
*
* @var string
* Store's the user name.
*/
private $user;
/**
* User password.
*
* @var string
* Store's the password.
*/
private $password;
/**
* User ID.
*
* @var string
* Store's the user ID.
*/
private $uid;
/**
* User Access Token.
*
* @var string
* Store's the user token.
*/
private $utk;
/**
* Debugging flag.
*
* @var bool
* Are we Debugging?
*/
private $debug;
/**
* A Config type that holds stored values.
*
* @var RocketChatConfigInterface
* Hold a reference to a Interface that actually does store data.
*/
private $superConfig;
/**
* InMemoryConfig constructor.
*
* @param \Drupal\rocket_chat_api\RocketChat\RocketChatConfigInterface $storedConfig
* Stored Config Object (READ ONLY).
* @param string $user
* User name.
* @param string $password
* User Password.
*/
public function __construct(RocketChatConfigInterface &$storedConfig, &$user, &$password) {
$this->superConfig = $storedConfig;
$this->url = $storedConfig
->getElement('server', "http://localhost:3000");
$this->user = $user;
$this->password = $password;
$this->uid = $storedConfig
->getElement('rocket_chat_uid');
$this->utk = $storedConfig
->getElement('rocket_chat_uit');
}
/**
* {@inheritdoc}
*/
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);
}
}
/**
* {@inheritdoc}
*/
public function setElement($elementName, $newValue) {
switch ($elementName) {
case 'rocket_chat_url':
case 'server':
return $this->url = $newValue;
case 'rocket_chat_uid':
return $this->uid = $newValue;
case 'rocket_chat_uit':
return $this->utk = $newValue;
default:
throw new \InvalidArgumentException("[{$elementName}] not found", 144);
}
}
/**
* {@inheritdoc}
*/
public function isDebug() {
return $this->debug;
}
/**
* {@inheritdoc}
*/
public function getJsonDecoder() {
return $this->superConfig
->getJsonDecoder();
}
/**
* {@inheritdoc}
*/
public function notify($message, $type) {
return $this->superConfig
->notify($message, $type);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
InMemoryConfig:: |
private | property | Debugging flag. | |
InMemoryConfig:: |
private | property | User password. | |
InMemoryConfig:: |
private | property | A Config type that holds stored values. | |
InMemoryConfig:: |
private | property | User ID. | |
InMemoryConfig:: |
private | property | Server URL. | |
InMemoryConfig:: |
private | property | User name. | |
InMemoryConfig:: |
private | property | User Access Token. | |
InMemoryConfig:: |
public | function |
Get a RocketChatConfigInterface Element. Overrides RocketChatConfigInterface:: |
|
InMemoryConfig:: |
public | function |
Get a function pointer to the function to use for JsonDecodeing. Overrides RocketChatConfigInterface:: |
|
InMemoryConfig:: |
public | function |
Is this a Debug / verbose Run. Overrides RocketChatConfigInterface:: |
|
InMemoryConfig:: |
public | function |
Notify the backend. Overrides RocketChatConfigInterface:: |
|
InMemoryConfig:: |
public | function |
Set an Element in the RocketChatConfigInterface. Overrides RocketChatConfigInterface:: |
|
InMemoryConfig:: |
public | function | InMemoryConfig constructor. |