PHPDaemon\Request\Generic::sleep PHP Method

sleep() public method

Delays the request execution for the given number of seconds
public sleep ( integer $time, boolean $set = false ) : void
$time integer Time to sleep in seconds
$set boolean Set this parameter to true when use call it outside of Request->run() or if you don't want to interrupt execution now
return void
    public function sleep($time = 0, $set = false)
    {
        if ($this->state === Generic::STATE_FINISHED) {
            return;
        }
        if ($this->state !== Generic::STATE_RUNNING) {
            $set = true;
        }
        $this->sleepTime = $time;
        if (!$set) {
            throw new RequestSleep();
        } else {
            $this->ev->del();
            $this->ev->add($this->sleepTime);
        }
        $this->state = Generic::STATE_WAITING;
    }