public function throttle()
    {
        $i = explode(' ',microtime());
        $now =  floatval($i[0]) + floatval($i[1])%10000;
        $elasped = $now - $this->timeStart;

        if ($elasped >= $this->withinSeconds) {
            $this->timeStart = $now;
            $this->requestCounter = 0;
        }
        $this->requestCounter++;

        $margin = $this->requestCounter * $this->averageTime - $elasped;
        if($margin > 0){
            usleep($margin*1000000);

        }
    }
public function throttle()
    {
        $i = explode(' ',microtime());
        $now =  floatval($i[0]) + floatval($i[1])%10000;
        $elasped = $now - $this->timeStart;

        if ($elasped >= $this->withinSeconds) {
            $this->timeStart = $now;
            $this->requestCounter = 0;
        }
        $this->requestCounter++;

        $margin = $this->requestCounter * $this->averageTime - $elasped;
        if($margin > 0){
            usleep($margin*1000000);

        }
    }
public function throttle ( ) { $ i = explode ( ' ' , microtime ( ) ) ; $ now = floatval ( $ i [ 0 ] ) + floatval ( $ i [ 1 ] ) % 10000 ; $ elasped = $ now - $ this -> timeStart ; if ( $ elasped >= $ this -> withinSeconds ) { $ this -> timeStart = $ now ; $ this -> requestCounter = 0 ; } $ this -> requestCounter ++ ; $ margin = $ this -> requestCounter * $ this -> averageTime - $ elasped ; if ( $ margin > 0 ) { usleep ( $ margin * 1000000 ) ; } }
This function apply time delay if required
This function apply time delay if required