Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Drupal\Core\KeyValueStore; /** * Defines a default key/value store impl..
Decoded Output download
<?php
namespace Drupal\Core\KeyValueStore;
/**
* Defines a default key/value store implementation.
*/
class MemoryStorage extends StorageBase {
/**
* The actual storage of key-value pairs.
*
* @var array
*/
protected $data = [];
/**
* {@inheritdoc}
*/
public function has($key) {
return array_key_exists($key, $this->data);
}
/**
* {@inheritdoc}
*/
public function get($key, $default = NULL) {
return array_key_exists($key, $this->data) ? $this->data[$key] : $default;
}
/**
* {@inheritdoc}
*/
public function getMultiple(array $keys) {
return array_intersect_key($this->data, array_flip($keys));
}
/**
* {@inheritdoc}
*/
public function getAll() {
return $this->data;
}
/**
* {@inheritdoc}
*/
public function set($key, $value) {
$this->data[$key] = $value;
}
/**
* {@inheritdoc}
*/
public function setIfNotExists($key, $value) {
if (!isset($this->data[$key])) {
$this->data[$key] = $value;
return TRUE;
}
return FALSE;
}
/**
* {@inheritdoc}
*/
public function setMultiple(array $data) {
$this->data = $data + $this->data;
}
/**
* {@inheritdoc}
*/
public function rename($key, $new_key) {
if ($key !== $new_key) {
$this->data[$new_key] = $this->data[$key];
unset($this->data[$key]);
}
}
/**
* {@inheritdoc}
*/
public function delete($key) {
unset($this->data[$key]);
}
/**
* {@inheritdoc}
*/
public function deleteMultiple(array $keys) {
foreach ($keys as $key) {
unset($this->data[$key]);
}
}
/**
* {@inheritdoc}
*/
public function deleteAll() {
$this->data = [];
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Drupal\Core\KeyValueStore;
/**
* Defines a default key/value store implementation.
*/
class MemoryStorage extends StorageBase {
/**
* The actual storage of key-value pairs.
*
* @var array
*/
protected $data = [];
/**
* {@inheritdoc}
*/
public function has($key) {
return array_key_exists($key, $this->data);
}
/**
* {@inheritdoc}
*/
public function get($key, $default = NULL) {
return array_key_exists($key, $this->data) ? $this->data[$key] : $default;
}
/**
* {@inheritdoc}
*/
public function getMultiple(array $keys) {
return array_intersect_key($this->data, array_flip($keys));
}
/**
* {@inheritdoc}
*/
public function getAll() {
return $this->data;
}
/**
* {@inheritdoc}
*/
public function set($key, $value) {
$this->data[$key] = $value;
}
/**
* {@inheritdoc}
*/
public function setIfNotExists($key, $value) {
if (!isset($this->data[$key])) {
$this->data[$key] = $value;
return TRUE;
}
return FALSE;
}
/**
* {@inheritdoc}
*/
public function setMultiple(array $data) {
$this->data = $data + $this->data;
}
/**
* {@inheritdoc}
*/
public function rename($key, $new_key) {
if ($key !== $new_key) {
$this->data[$new_key] = $this->data[$key];
unset($this->data[$key]);
}
}
/**
* {@inheritdoc}
*/
public function delete($key) {
unset($this->data[$key]);
}
/**
* {@inheritdoc}
*/
public function deleteMultiple(array $keys) {
foreach ($keys as $key) {
unset($this->data[$key]);
}
}
/**
* {@inheritdoc}
*/
public function deleteAll() {
$this->data = [];
}
}
Function Calls
None |
Stats
MD5 | 443606f99cc5c88a1e0e4f6c78851fac |
Eval Count | 0 |
Decode Time | 92 ms |