protected function processItem($item) {
        if($item instanceof \CharlotteDunois\Yasmin\Interfaces\RatelimitBucketInterface) {
            if($item->isBusy()) {
                $this->queue[] = $item;
                
                foreach($this->queue as $qitem) {
                    if(!($qitem instanceof \CharlotteDunois\Yasmin\Interfaces\RatelimitBucketInterface) || !$qitem->isBusy()) {
                        $this->processItem($qitem);
                        return;
                    }
                }
                
                return;
            }
            
            $item->setBusy(true);
            $buckItem = $this->extractFromBucket($item);
            
            if(!($buckItem instanceof \React\Promise\ExtendedPromiseInterface)) {
                $buckItem = \React\Promise\resolve($buckItem);
            }
            
            $buckItem->done(function ($req) use ($item) {
                $item->setBusy(false);
                
                if(!($req instanceof \CharlotteDunois\Yasmin\HTTP\APIRequest)) {
                    return;
                }
                
                $this->execute($req);
            }, array($this->client, 'handlePromiseRejection'));
        } else {
            if(!($item instanceof \CharlotteDunois\Yasmin\HTTP\APIRequest)) {
                return;
            }
            
            $this->execute($item);
        }
    }
protected function processItem($item) {
        if($item instanceof \CharlotteDunois\Yasmin\Interfaces\RatelimitBucketInterface) {
            if($item->isBusy()) {
                $this->queue[] = $item;
                
                foreach($this->queue as $qitem) {
                    if(!($qitem instanceof \CharlotteDunois\Yasmin\Interfaces\RatelimitBucketInterface) || !$qitem->isBusy()) {
                        $this->processItem($qitem);
                        return;
                    }
                }
                
                return;
            }
            
            $item->setBusy(true);
            $buckItem = $this->extractFromBucket($item);
            
            if(!($buckItem instanceof \React\Promise\ExtendedPromiseInterface)) {
                $buckItem = \React\Promise\resolve($buckItem);
            }
            
            $buckItem->done(function ($req) use ($item) {
                $item->setBusy(false);
                
                if(!($req instanceof \CharlotteDunois\Yasmin\HTTP\APIRequest)) {
                    return;
                }
                
                $this->execute($req);
            }, array($this->client, 'handlePromiseRejection'));
        } else {
            if(!($item instanceof \CharlotteDunois\Yasmin\HTTP\APIRequest)) {
                return;
            }
            
            $this->execute($item);
        }
    }
protected function processItem ( $ item ) { if ( $ item instanceof \ CharlotteDunois \ Yasmin \ Interfaces \ RatelimitBucketInterface ) { if ( $ item -> isBusy ( ) ) { $ this -> queue [ ] = $ item ; foreach ( $ this -> queue as $ qitem ) { if ( ! ( $ qitem instanceof \ CharlotteDunois \ Yasmin \ Interfaces \ RatelimitBucketInterface ) || ! $ qitem -> isBusy ( ) ) { $ this -> processItem ( $ qitem ) ; return ; } } return ; } $ item -> setBusy ( true ) ; $ buckItem = $ this -> extractFromBucket ( $ item ) ; if ( ! ( $ buckItem instanceof \ React \ Promise \ ExtendedPromiseInterface ) ) { $ buckItem = \ React \ Promise \ resolve ( $ buckItem ) ; } $ buckItem -> done ( function ( $ req ) use ( $ item ) { $ item -> setBusy ( false ) ; if ( ! ( $ req instanceof \ CharlotteDunois \ Yasmin \ HTTP \ APIRequest ) ) { return ; } $ this -> execute ( $ req ) ; } , array ( $ this -> client , 'handlePromiseRejection' ) ) ; } else { if ( ! ( $ item instanceof \ CharlotteDunois \ Yasmin \ HTTP \ APIRequest ) ) { return ; } $ this -> execute ( $ item ) ; } }
Processes a queue item.
@param \CharlotteDunois\Yasmin\HTTP\APIRequest|\CharlotteDunois\Yasmin\Interfaces\RatelimitBucketInterface|null  $item
@return void
Processes a queue item .