src/Internal/Delayer.php
public function add($time)
    {
        $deferred = new Deferred;
        $time = filter_var($time, FILTER_VALIDATE_FLOAT);
        if ($time === false) {
            throw new \InvalidArgumentException('Delay must be number.');
        }
        if ($time < 0) {
            throw new \DomainException('Delay must be positive.');
        }
        do {
            $id = uniqid();
        } while (isset($this->untils[$id]));
        $this->untils[$id] = microtime(true) + $time;
        $this->deferreds[$id] = $deferred;
        return $deferred->promise();
    }
public function add($time)
    {
        $deferred = new Deferred;
        $time = filter_var($time, FILTER_VALIDATE_FLOAT);
        if ($time === false) {
            throw new \InvalidArgumentException('Delay must be number.');
        }
        if ($time < 0) {
            throw new \DomainException('Delay must be positive.');
        }
        do {
            $id = uniqid();
        } while (isset($this->untils[$id]));
        $this->untils[$id] = microtime(true) + $time;
        $this->deferreds[$id] = $deferred;
        return $deferred->promise();
    }
public function add ( $ time ) { $ deferred = new Deferred ; $ time = filter_var ( $ time , FILTER_VALIDATE_FLOAT ) ; if ( $ time === false ) { throw new \ InvalidArgumentException ( 'Delay must be number.' ) ; } if ( $ time < 0 ) { throw new \ DomainException ( 'Delay must be positive.' ) ; } do { $ id = uniqid ( ) ; } while ( isset ( $ this -> untils [ $ id ] ) ) ; $ this -> untils [ $ id ] = microtime ( true ) + $ time ; $ this -> deferreds [ $ id ] = $ deferred ; return $ deferred -> promise ( ) ; }
Add delay.
@param int $time
@return PromiseInterface
Add delay .