public function getDefaultWait() { $wait = parent::getDefaultWait(); if ($this->timeout) { if (!$this->start) { $this->start = microtime(true); } $elapsed = microtime(true) - $this->start; $wait = max(0, min($this->timeout - $elapsed, $wait)); } return $wait; }