function State::get

Same name in other branches
  1. 9 core/lib/Drupal/Core/State/State.php \Drupal\Core\State\State::get()
  2. 8.9.x core/lib/Drupal/Core/State/State.php \Drupal\Core\State\State::get()
  3. 10 core/lib/Drupal/Core/State/State.php \Drupal\Core\State\State::get()

Overrides CacheCollector::get

1 call to State::get()
State::getMultiple in core/lib/Drupal/Core/State/State.php
Returns the stored key/value pairs for a given set of keys.

File

core/lib/Drupal/Core/State/State.php, line 51

Class

State
Provides the state system using a key value store.

Namespace

Drupal\Core\State

Code

public function get($key, $default = NULL) {
    // If the caller is asking for the value of a deprecated state, trigger a
    // deprecation message about it.
    if (isset(self::$deprecatedState[$key])) {
        // phpcs:ignore Drupal.Semantics.FunctionTriggerError
        @trigger_error(self::$deprecatedState[$key]['message'], E_USER_DEPRECATED);
        $key = self::$deprecatedState[$key]['replacement'];
    }
    return parent::get($key) ?? $default;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.