ajout de chargeAll()

This commit is contained in:
Jephté Clain 2025-06-23 22:40:26 +04:00
parent 5dc2d3d019
commit f34694e12d
2 changed files with 14 additions and 0 deletions

View File

@ -143,6 +143,16 @@ class Capacitor implements ITransactor {
return $this->storage->_charge($this->channel, $item, $func, $args, $row);
}
function chargeAll(?iterable $items, $func=null, ?array $args=null): int {
$count = 0;
if ($items !== null) {
foreach ($items as $item) {
$count += $this->charge($item, $func, $args);
}
}
return $count;
}
function discharge(bool $reset=true): Traversable {
return $this->storage->_discharge($this->channel, $reset);
}

View File

@ -444,6 +444,10 @@ class CapacitorChannel implements ITransactor {
return $this->capacitor->charge($item, $func, $args, $row);
}
function chargeAll(iterable $items, $func=null, ?array $args=null): int {
return $this->capacitor->chargeAll($items, $func, $args);
}
function discharge(bool $reset=true): Traversable {
return $this->capacitor->discharge($reset);
}