ajout de chargeAll()
This commit is contained in:
parent
5dc2d3d019
commit
f34694e12d
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user