You are here

class Settings in Drupalmonitor 8

Class Settings.

@package Drupal\drupalmonitor

Hierarchy

Expanded class hierarchy of Settings

3 files declare their use of Settings
drupalmonitor.install in ./drupalmonitor.install
Installer file of drupalmonitor module
DrupalMonitorController.php in src/Controller/DrupalMonitorController.php
SettingsForm.php in src/Form/SettingsForm.php
1 string reference to 'Settings'
drupalmonitor.services.yml in ./drupalmonitor.services.yml
drupalmonitor.services.yml
1 service uses Settings
drupalmonitor.settings in ./drupalmonitor.services.yml
Drupal\drupalmonitor\Settings

File

src/Settings.php, line 12

Namespace

Drupal\drupalmonitor
View source
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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Settings::$configFactory protected property Drupal\Core\Config\ConfigFactoryInterface definition.
Settings::$settings protected property Settings.
Settings::CONFIG_KEY_FILES_MONITORING constant Config Key for Files Monitoring.
Settings::CONFIG_KEY_HASH constant Config Key for Hash.
Settings::CONFIG_KEY_MODULES_MONITORING constant Config Key for Modules Monitoring.
Settings::CONFIG_KEY_NODE_MONITORING constant Config Key for Node Monitoring.
Settings::CONFIG_KEY_SERVER_MONITORING constant Config Key for Server Monitoring.
Settings::CONFIG_KEY_USER_MONITORING constant Config Key for User Monitoring.
Settings::CONFIG_KEY_VARIABLES_MONITORING constant Config Key for Variables Monitoring.
Settings::CONFIG_NAME constant Config Name.
Settings::getHash public function Get Hash.
Settings::isFilesMonitoringEnabled public function Check whether Files Monitoring is enabled.
Settings::isModulesMonitoringEnabled public function Check whether Modules Monitoring is enabled.
Settings::isNodeMonitoringEnabled public function Check whether Node Monitoring is enabled.
Settings::isServerMonitoringEnabled public function Check whether Server Monitoring is enabled.
Settings::isUserMonitoringEnabled public function Check whether User Monitoring is enabled.
Settings::isVariablesMonitoringEnabled public function Check whether Variables Monitoring is enabled.
Settings::__construct public function Settings constructor.