/**
* @param Acknowledger|null $ack The function to call to ack/nack the $message.
* The message should be handled synchronously when null.
*
* @return mixed The number of pending messages in the batch if $ack is not null,
* the result from handling the message otherwise
*/
private function handle(object
$message, ?Acknowledger
$ack): mixed
{ if (null ===
$ack) { $ack =
new Acknowledger(get_debug_type($this));
$this->jobs
[] =
[$message,
$ack];
$this->
flush(true
);
return $ack->
getResult();
} $this->jobs
[] =
[$message,
$ack];
if (!
$this->
shouldFlush()) { return \
count($this->jobs
);
}