From 367e1a8823d98a29b9b909d46c1d9da6e543d7b0 Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Wed, 30 Apr 2014 11:50:18 +0100
Subject: [PATCH] Issue #2250491 by damiankloip: Remove duplicate methods from
 Settings class.

---
 core/lib/Drupal/Core/Site/Settings.php        | 55 +++++--------------
 .../Translator/CustomStrings.php              |  2 +-
 2 files changed, 14 insertions(+), 43 deletions(-)

diff --git a/core/lib/Drupal/Core/Site/Settings.php b/core/lib/Drupal/Core/Site/Settings.php
index 950ccd4af11d..fe2260d7a8b9 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 8decfde45138..24f5085148ca 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());
   }
 
 }
-- 
GitLab