protected function extractFromBucket(\CharlotteDunois\Yasmin\Interfaces\RatelimitBucketInterface $item) {
        if($item->size() > 0) {
            $meta = $item->getMeta();
            
            if($meta instanceof \React\Promise\ExtendedPromiseInterface) {
                return $meta->then(function ($data) use (&$item) {
                    if(!$data['limited']) {
                        $this->client->emit('debug', 'Retrieved item from bucket "'.$item->getEndpoint().'"');
                        return $item->shift();
                    }
                    
                    $this->queue[] = $item;
                    
                    $this->client->addTimer(($data['resetTime'] - \microtime(true)), function () {
                        $this->process();
                    });
                }, function ($error) use (&$item) {
                    $this->queue[] = $item;
                    $this->client->emit('error', $error);
                    
                    $this->process();
                    return false;
                });
            } else {
                if(!$meta['limited']) {
                    $this->client->emit('debug', 'Retrieved item from bucket "'.$item->getEndpoint().'"');
                    return $item->shift();
                }
                
                $this->queue[] = $item;
                
                $this->client->addTimer(($meta['resetTime'] - \microtime(true)), function () {
                    $this->process();
                });
            }
        }
        
        return false;
    }
protected function extractFromBucket(\CharlotteDunois\Yasmin\Interfaces\RatelimitBucketInterface $item) {
        if($item->size() > 0) {
            $meta = $item->getMeta();
            
            if($meta instanceof \React\Promise\ExtendedPromiseInterface) {
                return $meta->then(function ($data) use (&$item) {
                    if(!$data['limited']) {
                        $this->client->emit('debug', 'Retrieved item from bucket "'.$item->getEndpoint().'"');
                        return $item->shift();
                    }
                    
                    $this->queue[] = $item;
                    
                    $this->client->addTimer(($data['resetTime'] - \microtime(true)), function () {
                        $this->process();
                    });
                }, function ($error) use (&$item) {
                    $this->queue[] = $item;
                    $this->client->emit('error', $error);
                    
                    $this->process();
                    return false;
                });
            } else {
                if(!$meta['limited']) {
                    $this->client->emit('debug', 'Retrieved item from bucket "'.$item->getEndpoint().'"');
                    return $item->shift();
                }
                
                $this->queue[] = $item;
                
                $this->client->addTimer(($meta['resetTime'] - \microtime(true)), function () {
                    $this->process();
                });
            }
        }
        
        return false;
    }
protected function extractFromBucket ( \ CharlotteDunois \ Yasmin \ Interfaces \ RatelimitBucketInterface $ item ) { if ( $ item -> size ( ) > 0 ) { $ meta = $ item -> getMeta ( ) ; if ( $ meta instanceof \ React \ Promise \ ExtendedPromiseInterface ) { return $ meta -> then ( function ( $ data ) use ( & $ item ) { if ( ! $ data [ 'limited' ] ) { $ this -> client -> emit ( 'debug' , 'Retrieved item from bucket "' . $ item -> getEndpoint ( ) . '"' ) ; return $ item -> shift ( ) ; } $ this -> queue [ ] = $ item ; $ this -> client -> addTimer ( ( $ data [ 'resetTime' ] - \ microtime ( true ) ) , function ( ) { $ this -> process ( ) ; } ) ; } , function ( $ error ) use ( & $ item ) { $ this -> queue [ ] = $ item ; $ this -> client -> emit ( 'error' , $ error ) ; $ this -> process ( ) ; return false ; } ) ; } else { if ( ! $ meta [ 'limited' ] ) { $ this -> client -> emit ( 'debug' , 'Retrieved item from bucket "' . $ item -> getEndpoint ( ) . '"' ) ; return $ item -> shift ( ) ; } $ this -> queue [ ] = $ item ; $ this -> client -> addTimer ( ( $ meta [ 'resetTime' ] - \ microtime ( true ) ) , function ( ) { $ this -> process ( ) ; } ) ; } } return false ; }
Extracts an item from a ratelimit bucket.
@param \CharlotteDunois\Yasmin\Interfaces\RatelimitBucketInterface  $item
@return \CharlotteDunois\Yasmin\HTTP\APIRequest|bool|\React\Promise\ExtendedPromiseInterface
Extracts an item from a ratelimit bucket .