Thruway\Session::decPendingCallCount PHP Method

decPendingCallCount() public method

public decPendingCallCount ( ) : integer
return integer
    public function decPendingCallCount()
    {
        // if we are already at zero - something is wrong
        if ($this->pendingCallCount == 0) {
            Logger::alert($this, 'Session pending call count wants to go negative.');
            return 0;
        }
        return $this->pendingCallCount--;
    }

Usage Example

Example #1
0
 /**
  * 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;
                 }
             }
         }
     }
 }