public function MemoryStorage::setIfNotExists in Service Container 7
Same name and namespace in other branches
- 7.2 lib/Drupal/Core/KeyValueStore/MemoryStorage.php \Drupal\Core\KeyValueStore\MemoryStorage::setIfNotExists()
Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::setIfNotExists().
Overrides KeyValueStoreInterface::setIfNotExists
File
- lib/
Drupal/ Core/ KeyValueStore/ MemoryStorage.php, line 60 - Contains \Drupal\Core\KeyValueStore\MemoryStorage.
Class
- MemoryStorage
- Defines a default key/value store implementation.
Namespace
Drupal\Core\KeyValueStoreCode
public function setIfNotExists($key, $value) {
if (!isset($this->data[$key])) {
$this->data[$key] = $value;
return TRUE;
}
return FALSE;
}