diff --git a/core/lib/Drupal/Core/Site/Settings.php b/core/lib/Drupal/Core/Site/Settings.php index 950ccd4af11dbd23583fa9191a5d739b0aca36bb..fe2260d7a8b9ebc02aea1c9bbda7128884396689 100644 --- a/core/lib/Drupal/Core/Site/Settings.php +++ b/core/lib/Drupal/Core/Site/Settings.php @@ -28,6 +28,17 @@ final class Settings { */ private static $instance; + /** + * Constructor. + * + * @param array $settings + * Array with the settings. + */ + public function __construct(array $settings) { + $this->storage = $settings; + self::$instance = $this; + } + /** * Returns the settings instance. * @@ -56,7 +67,7 @@ public static function getInstance() { * The value of the setting, the provided default if not set. */ public static function get($name, $default = NULL) { - return self::$instance->getSetting($name, $default); + return isset(self::$instance->storage[$name]) ? self::$instance->storage[$name] : $default; } /** @@ -66,47 +77,7 @@ public static function get($name, $default = NULL) { * All the settings. */ public static function getAll() { - return self::$instance->getAllSettings(); - } - - /** - * Constructor. - * - * @param array $settings - * Array with the settings. - */ - function __construct(array $settings) { - $this->storage = $settings; - self::$instance = $this; - } - - /** - * Returns a setting. - * - * Settings can be set in settings.php in the $settings array and requested - * by this function. Settings should be used over configuration for read-only, - * possibly low bootstrap configuration that is environment specific. - * - * @param string $name - * The name of the setting to return. - * @param mixed $default - * (optional) The default value to use if this setting is not set. - * - * @return mixed - * The value of the setting, the provided default if not set. - */ - public function getSetting($name, $default = NULL) { - return isset($this->storage[$name]) ? $this->storage[$name] : $default; - } - - /** - * Returns all the settings. This is only used for testing purposes. - * - * @return array - * All the settings. - */ - public function getAllSettings() { - return $this->storage; + return self::$instance->storage; } } diff --git a/core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php b/core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php index 8decfde4513866058fa45b47d34959cdf03b3ca4..24f5085148ca5a54726249f53c258d159ae3c8c0 100644 --- a/core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php +++ b/core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php @@ -39,7 +39,7 @@ public function __construct(Settings $settings) { * {@inheritdoc} */ protected function getLanguage($langcode) { - return $this->settings->getSetting('locale_custom_strings_' . $langcode, array()); + return $this->settings->get('locale_custom_strings_' . $langcode, array()); } }