TestConfig.class.inc in Rocket.Chat 8.2
Same filename and directory in other branches
Namespace
Drupal\rocket_chat_api\RocketChatFile
modules/rocket_chat_api/src/RocketChat/TestConfig.class.incView source
<?php
namespace Drupal\rocket_chat_api\RocketChat {
/*
* Created by PhpStorm.
* User: lawri
* Date: 6/25/17
* Time: 3:41 PM
*/
/**
* Class Test7Config For Testing.
*
* @package Drupal\rocket_chat_api\RocketChat
*/
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);
}
}
}
namespace {
/**
* {@inheritdoc}
*/
function drupal_json_decode($json) {
return \GuzzleHttp\json_decode($json, TRUE);
}
}
Functions
Name![]() |
Description |
---|---|
drupal_json_decode |
Classes
Name![]() |
Description |
---|---|
Test7Config | Class Test7Config For Testing. |