summaryrefslogtreecommitdiff
path: root/vendor/symfony/cache/Adapter/AbstractAdapter.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/cache/Adapter/AbstractAdapter.php')
-rw-r--r--vendor/symfony/cache/Adapter/AbstractAdapter.php36
1 files changed, 18 insertions, 18 deletions
diff --git a/vendor/symfony/cache/Adapter/AbstractAdapter.php b/vendor/symfony/cache/Adapter/AbstractAdapter.php
index 571eb1468a..d93ae711bd 100644
--- a/vendor/symfony/cache/Adapter/AbstractAdapter.php
+++ b/vendor/symfony/cache/Adapter/AbstractAdapter.php
@@ -64,12 +64,12 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
null,
CacheItem::class
);
- $getId = \Closure::fromCallable(array($this, 'getId'));
+ $getId = \Closure::fromCallable([$this, 'getId']);
$this->mergeByLifetime = \Closure::bind(
function ($deferred, $namespace, &$expiredIds) use ($getId) {
- $byLifetime = array();
+ $byLifetime = [];
$now = microtime(true);
- $expiredIds = array();
+ $expiredIds = [];
foreach ($deferred as $key => $item) {
$key = (string) $key;
@@ -83,7 +83,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
unset($metadata[CacheItem::METADATA_TAGS]);
}
// For compactness, expiry and creation duration are packed in the key of an array, using magic numbers as separators
- $byLifetime[$ttl][$getId($key)] = $metadata ? array("\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $item->value) : $item->value;
+ $byLifetime[$ttl][$getId($key)] = $metadata ? ["\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $item->value] : $item->value;
}
return $byLifetime;
@@ -131,7 +131,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
return $apcu;
}
- public static function createConnection($dsn, array $options = array())
+ public static function createConnection($dsn, array $options = [])
{
if (!\is_string($dsn)) {
throw new InvalidArgumentException(sprintf('The %s() method expect argument #1 to be string, %s given.', __METHOD__, \gettype($dsn)));
@@ -161,11 +161,11 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
$value = null;
try {
- foreach ($this->doFetch(array($id)) as $value) {
+ foreach ($this->doFetch([$id]) as $value) {
$isHit = true;
}
} catch (\Exception $e) {
- CacheItem::log($this->logger, 'Failed to fetch key "{key}"', array('key' => $key, 'exception' => $e));
+ CacheItem::log($this->logger, 'Failed to fetch key "{key}"', ['key' => $key, 'exception' => $e]);
}
return $f($key, $value, $isHit);
@@ -174,12 +174,12 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
/**
* {@inheritdoc}
*/
- public function getItems(array $keys = array())
+ public function getItems(array $keys = [])
{
if ($this->deferred) {
$this->commit();
}
- $ids = array();
+ $ids = [];
foreach ($keys as $key) {
$ids[] = $this->getId($key);
@@ -187,8 +187,8 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
try {
$items = $this->doFetch($ids);
} catch (\Exception $e) {
- CacheItem::log($this->logger, 'Failed to fetch requested items', array('keys' => $keys, 'exception' => $e));
- $items = array();
+ CacheItem::log($this->logger, 'Failed to fetch requested items', ['keys' => $keys, 'exception' => $e]);
+ $items = [];
}
$ids = array_combine($ids, $keys);
@@ -229,7 +229,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
$ok = true;
$byLifetime = $this->mergeByLifetime;
$byLifetime = $byLifetime($this->deferred, $this->namespace, $expiredIds);
- $retry = $this->deferred = array();
+ $retry = $this->deferred = [];
if ($expiredIds) {
$this->doDelete($expiredIds);
@@ -239,7 +239,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
$e = $this->doSave($values, $lifetime);
} catch (\Exception $e) {
}
- if (true === $e || array() === $e) {
+ if (true === $e || [] === $e) {
continue;
}
if (\is_array($e) || 1 === \count($values)) {
@@ -247,7 +247,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
$ok = false;
$v = $values[$id];
$type = \is_object($v) ? \get_class($v) : \gettype($v);
- CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', array('key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null));
+ CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null]);
}
} else {
foreach ($values as $id => $v) {
@@ -261,15 +261,15 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
foreach ($ids as $id) {
try {
$v = $byLifetime[$lifetime][$id];
- $e = $this->doSave(array($id => $v), $lifetime);
+ $e = $this->doSave([$id => $v], $lifetime);
} catch (\Exception $e) {
}
- if (true === $e || array() === $e) {
+ if (true === $e || [] === $e) {
continue;
}
$ok = false;
$type = \is_object($v) ? \get_class($v) : \gettype($v);
- CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', array('key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null));
+ CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null]);
}
}
@@ -297,7 +297,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
yield $key => $f($key, $value, true);
}
} catch (\Exception $e) {
- CacheItem::log($this->logger, 'Failed to fetch requested items', array('keys' => array_values($keys), 'exception' => $e));
+ CacheItem::log($this->logger, 'Failed to fetch requested items', ['keys' => array_values($keys), 'exception' => $e]);
}
foreach ($keys as $key) {