/**
* Remove call
*
* @param \Thruway\Call $callToRemove
*/
public function removeCall($callToRemove)
{
/* @var $call \Thruway\Call */
foreach ($this->calls as $i => $call) {
if ($callToRemove === $call) {
array_splice($this->calls, $i, 1);
$this->session->decPendingCallCount();
$callEnd = microtime(true);
// average call time
$callsInAverage = $this->invocationCount - count($this->calls) - 1;
// add this call time into the total
$this->completedCallTimeTotal += $callEnd - $call->getCallStart();
$callsInAverage++;
$this->invocationAverageTime = (double) $this->completedCallTimeTotal / $callsInAverage;
if (count($this->calls) == 0) {
$this->lastIdledAt = new \DateTime();
if ($this->busyStart !== null) {
$this->busyTime = $this->busyTime + ($callEnd - $this->busyStart);
$this->busyStart = null;
}
}
}
}
}