Settings.php in Drupalmonitor 8
Namespace
Drupal\drupalmonitorFile
src/Settings.phpView source
<?php
namespace Drupal\drupalmonitor;
use Drupal\Core\Config\ConfigFactoryInterface;
/**
* Class Settings.
*
* @package Drupal\drupalmonitor
*/
class Settings {
/**
* Config Name.
*/
const CONFIG_NAME = 'drupalmonitor.settings';
/**
* Config Key for Hash.
*/
const CONFIG_KEY_HASH = 'drupalmonitor_hash';
/**
* Config Key for Files Monitoring.
*/
const CONFIG_KEY_FILES_MONITORING = 'drupalmonitor_files_monitoring';
/**
* Config Key for Server Monitoring.
*/
const CONFIG_KEY_SERVER_MONITORING = 'drupalmonitor_server_monitoring';
/**
* Config Key for User Monitoring.
*/
const CONFIG_KEY_USER_MONITORING = 'drupalmonitor_user_monitoring';
/**
* Config Key for Node Monitoring.
*/
const CONFIG_KEY_NODE_MONITORING = 'drupalmonitor_node_monitoring';
/**
* Config Key for Modules Monitoring.
*/
const CONFIG_KEY_MODULES_MONITORING = 'drupalmonitor_modules_monitoring';
/**
* Config Key for Variables Monitoring.
*/
const CONFIG_KEY_VARIABLES_MONITORING = 'drupalmonitor_variables_monitoring';
/**
* Drupal\Core\Config\ConfigFactoryInterface definition.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Settings.
*
* @var \Drupal\Core\Config\ImmutableConfig
*/
protected $settings;
/**
* Settings constructor.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* Config Factory.
*/
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
$this->settings = $this->configFactory
->get(static::CONFIG_NAME);
}
/**
* Check whether Files Monitoring is enabled.
*
* @return bool
* TRUE if enabled, otherwise FALSE.
*/
public function isFilesMonitoringEnabled() {
return $this->settings
->get(static::CONFIG_KEY_FILES_MONITORING);
}
/**
* Check whether Server Monitoring is enabled.
*
* @return bool
* TRUE if enabled, otherwise FALSE.
*/
public function isServerMonitoringEnabled() {
return $this->settings
->get(static::CONFIG_KEY_SERVER_MONITORING);
}
/**
* Check whether User Monitoring is enabled.
*
* @return bool
* TRUE if enabled, otherwise FALSE.
*/
public function isUserMonitoringEnabled() {
return $this->settings
->get(static::CONFIG_KEY_USER_MONITORING);
}
/**
* Check whether Node Monitoring is enabled.
*
* @return bool
* TRUE if enabled, otherwise FALSE.
*/
public function isNodeMonitoringEnabled() {
return $this->settings
->get(static::CONFIG_KEY_NODE_MONITORING);
}
/**
* Check whether Modules Monitoring is enabled.
*
* @return bool
* TRUE if enabled, otherwise FALSE.
*/
public function isModulesMonitoringEnabled() {
return $this->settings
->get(static::CONFIG_KEY_MODULES_MONITORING);
}
/**
* Check whether Variables Monitoring is enabled.
*
* @return bool
* TRUE if enabled, otherwise FALSE.
*/
public function isVariablesMonitoringEnabled() {
return $this->settings
->get(static::CONFIG_KEY_VARIABLES_MONITORING);
}
/**
* Get Hash.
*
* @return string|null
* Hash.
*/
public function getHash() {
return $this->settings
->get(static::CONFIG_KEY_HASH);
}
}