0.0; $endTime = $this->getCurrentTimeMillis() + $totalPollTimeoutMillis; while (\true) { if ($hasTotalPollTimeout && $this->getCurrentTimeMillis() > $endTime) { return \false; } $this->sleepMillis($currentPollDelayMillis); if ($pollCallable()) { return \true; } $currentPollDelayMillis = (int) \min([$currentPollDelayMillis * $pollDelayMultiplier, $maxPollDelayMillis]); } } /** * Protected to allow overriding for tests * * @return float Current time in milliseconds */ protected function getCurrentTimeMillis() { return \microtime(\true) * 1000.0; } /** * Protected to allow overriding for tests * * @param int $millis */ protected function sleepMillis(int $millis) { \usleep($millis * 1000); } }