You are here

public function StorageBase::get in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/KeyValueStore/StorageBase.php \Drupal\Core\KeyValueStore\StorageBase::get()
  2. 9 core/lib/Drupal/Core/KeyValueStore/StorageBase.php \Drupal\Core\KeyValueStore\StorageBase::get()

File

core/lib/Drupal/Core/KeyValueStore/StorageBase.php, line 34

Class

StorageBase
Provides a base class for key/value storage implementations.

Namespace

Drupal\Core\KeyValueStore

Code

public function get($key, $default = NULL) {
  $values = $this
    ->getMultiple([
    $key,
  ]);
  return $values[$key] ?? $default;
}