mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-14 10:53:51 +09:00
Update dependencies
This commit is contained in:
@@ -29,9 +29,8 @@ class CouchbaseCollectionAdapter extends AbstractAdapter
|
||||
{
|
||||
private const MAX_KEY_LENGTH = 250;
|
||||
|
||||
/** @var Collection */
|
||||
private $connection;
|
||||
private $marshaller;
|
||||
private Collection $connection;
|
||||
private MarshallerInterface $marshaller;
|
||||
|
||||
public function __construct(Collection $connection, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
|
||||
{
|
||||
@@ -48,17 +47,10 @@ class CouchbaseCollectionAdapter extends AbstractAdapter
|
||||
$this->marshaller = $marshaller ?? new DefaultMarshaller();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|string $dsn
|
||||
*
|
||||
* @return Bucket|Collection
|
||||
*/
|
||||
public static function createConnection($dsn, array $options = [])
|
||||
public static function createConnection(array|string $dsn, array $options = []): Bucket|Collection
|
||||
{
|
||||
if (\is_string($dsn)) {
|
||||
$dsn = [$dsn];
|
||||
} elseif (!\is_array($dsn)) {
|
||||
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be array or string, "%s" given.', __METHOD__, get_debug_type($dsn)));
|
||||
}
|
||||
|
||||
if (!static::isSupported()) {
|
||||
@@ -78,7 +70,7 @@ class CouchbaseCollectionAdapter extends AbstractAdapter
|
||||
$password = $options['password'] ?? '';
|
||||
|
||||
foreach ($dsn as $server) {
|
||||
if (0 !== strpos($server, 'couchbase:')) {
|
||||
if (!str_starts_with($server, 'couchbase:')) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid Couchbase DSN: "%s" does not start with "couchbase:".', $server));
|
||||
}
|
||||
|
||||
@@ -148,7 +140,7 @@ class CouchbaseCollectionAdapter extends AbstractAdapter
|
||||
foreach ($ids as $id) {
|
||||
try {
|
||||
$resultCouchbase = $this->connection->get($id);
|
||||
} catch (DocumentNotFoundException $exception) {
|
||||
} catch (DocumentNotFoundException) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -189,7 +181,7 @@ class CouchbaseCollectionAdapter extends AbstractAdapter
|
||||
if (null === $result->mutationToken()) {
|
||||
$idsErrors[] = $id;
|
||||
}
|
||||
} catch (DocumentNotFoundException $exception) {
|
||||
} catch (DocumentNotFoundException) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +191,7 @@ class CouchbaseCollectionAdapter extends AbstractAdapter
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave(array $values, $lifetime)
|
||||
protected function doSave(array $values, $lifetime): array|bool
|
||||
{
|
||||
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
||||
return $failed;
|
||||
@@ -212,7 +204,7 @@ class CouchbaseCollectionAdapter extends AbstractAdapter
|
||||
foreach ($values as $key => $value) {
|
||||
try {
|
||||
$this->connection->upsert($key, $value, $upsertOptions);
|
||||
} catch (\Exception $exception) {
|
||||
} catch (\Exception) {
|
||||
$ko[$key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user