You are here

public function SharedTempStore::getIfOwner in Zircon Profile 8

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

Retrieves a value from this SharedTempStore for a given key.

Only returns the value if the value is owned by $this->owner.

Parameters

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

Return value

mixed The data associated with the key, or NULL if the key does not exist.

File

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

Class

SharedTempStore
Stores and retrieves temporary data for a given owner.

Namespace

Drupal\user

Code

public function getIfOwner($key) {
  if (($object = $this->storage
    ->get($key)) && $object->owner == $this->owner) {
    return $object->data;
  }
}