private static function pollWait() { $parts = parse_url(static::$endpoint); foreach (FibonacciFactory::sequence(50000, 10000, 10) as $offset => $sleepTime) { usleep($sleepTime); $socket = @fsockopen($parts['host'], $parts['port'], $errorNumber, $errorString, 1); if ($socket !== false) { fclose($socket); return; } } }
private function pollWait() { foreach (FibonacciFactory::sequence(50000, 10000) as $sleepTime) { try { usleep($sleepTime); $this->getClient()->head('/_me')->send(); break; } catch (CurlException $e) { continue; } } }
public function testExceptionIsThrownIfOffsetIsNotAPositiveNumber_2() { $this->setExpectedException('hmmmath\\Exception\\InvalidArgumentException', 'Expected parameter #4 to be of type "integer<unsigned>", "string" given'); FibonacciFactory::sequence(0, 1, 0, 'foo'); }