modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2025-05-15 11:52:33 +04:00
parent 1f68c4bac4
commit 43c53b286a
3 changed files with 15 additions and 2 deletions

View File

@ -177,11 +177,12 @@ class A {
return $pvalue;
}
static final function shift(?array &$dest, int $count=1) {
static final function shift(?array &$dest, int $count=1, $default=null) {
if ($dest === null) return null;
$values = array_slice($dest, 0, $count);
$dest = array_slice($dest, $count);
return $count == 1? $values[0]: $values;
if ($values === []) return $default;
else return $count == 1? $values[0]: $values;
}
static final function pop(&$dest, $key, $default=null) {

View File

@ -1,6 +1,7 @@
<?php
namespace nulib\db;
use nulib\cl;
use nulib\php\func;
use nulib\ValueException;
use Traversable;
@ -168,6 +169,13 @@ class Capacitor implements ITransactor {
return $this->storage->_delete($this->channel, $filter, $func, $args);
}
function dbUpdate(array $update) {
return $this->storage->db()->exec(cl::merge([
"update",
"table" => $this->getTableName(),
], $update));
}
function close(): void {
$this->storage->close();
}

View File

@ -482,6 +482,10 @@ class CapacitorChannel implements ITransactor {
return $this->capacitor->delete($filter, $func, $args);
}
function dbUpdate(array $update) {
return $this->capacitor->dbUpdate($update);
}
function close(): void {
$this->capacitor->close();
}