You are here

public function SharedTempStore::getMetadata in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/user/src/SharedTempStore.php \Drupal\user\SharedTempStore::getMetadata()

Returns the metadata associated with a particular key/value pair.

Parameters

string $key: The key of the data to store.

Return value

mixed An object with the owner and updated time if the key has a value, or NULL otherwise.

File

core/modules/user/src/SharedTempStore.php, line 221
Contains \Drupal\user\SharedTempStore.

Class

SharedTempStore
Stores and retrieves temporary data for a given owner.

Namespace

Drupal\user

Code

public function getMetadata($key) {

  // Fetch the key/value pair and its metadata.
  $object = $this->storage
    ->get($key);
  if ($object) {

    // Don't keep the data itself in memory.
    unset($object->data);
    return $object;
  }
}