protected function parseInfiniteProvided(\CharlotteDunois\Livia\Commands\Context $context, array $values = array(), \CharlotteDunois\Livia\Arguments\ArgumentBag $bag, int $i = 0) {
        if(empty($values)) {
            return $this->obtainInfinite($context, array(), $bag);
        }
        
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($context, &$values, $bag, $i) {
            $value = $values[$i];
            $val = null;
            
            $validate = ($this->validate ? array($this, 'validate') : array($this->type, 'validate'))($value, $context, $this);
            if(!($validate instanceof \React\Promise\PromiseInterface)) {
                $validate = \React\Promise\resolve($validate);
            }
            
            return $validate->then(function ($valid) use ($context, $value, $bag, &$val) {
                if($valid !== true) {
                    $val = $valid;
                    return $this->obtainInfinite($context, array($value), $bag, $val);
                }
                
                return ($this->parse ? array($this, 'parse') : array($this->type, 'parse'))($value, $context, $this);
            })->then(function ($value) use ($context, &$values, $bag, $i, &$val) {
                if($val !== null) {
                    return $value;
                }
                
                $bag->values[] = $value;
                $i++;
                
                if($i < \count($values)) {
                    return $this->parseInfiniteProvided($context, $values, $bag, $i);
                }
                
                return $bag->done();
            })->done($resolve, $reject);
        }));
    }
protected function parseInfiniteProvided(\CharlotteDunois\Livia\Commands\Context $context, array $values = array(), \CharlotteDunois\Livia\Arguments\ArgumentBag $bag, int $i = 0) {
        if(empty($values)) {
            return $this->obtainInfinite($context, array(), $bag);
        }
        
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($context, &$values, $bag, $i) {
            $value = $values[$i];
            $val = null;
            
            $validate = ($this->validate ? array($this, 'validate') : array($this->type, 'validate'))($value, $context, $this);
            if(!($validate instanceof \React\Promise\PromiseInterface)) {
                $validate = \React\Promise\resolve($validate);
            }
            
            return $validate->then(function ($valid) use ($context, $value, $bag, &$val) {
                if($valid !== true) {
                    $val = $valid;
                    return $this->obtainInfinite($context, array($value), $bag, $val);
                }
                
                return ($this->parse ? array($this, 'parse') : array($this->type, 'parse'))($value, $context, $this);
            })->then(function ($value) use ($context, &$values, $bag, $i, &$val) {
                if($val !== null) {
                    return $value;
                }
                
                $bag->values[] = $value;
                $i++;
                
                if($i < \count($values)) {
                    return $this->parseInfiniteProvided($context, $values, $bag, $i);
                }
                
                return $bag->done();
            })->done($resolve, $reject);
        }));
    }
protected function parseInfiniteProvided ( \ CharlotteDunois \ Livia \ Commands \ Context $ context , array $ values = array ( ) , \ CharlotteDunois \ Livia \ Arguments \ ArgumentBag $ bag , int $ i = 0 ) { if ( empty ( $ values ) ) { return $ this -> obtainInfinite ( $ context , array ( ) , $ bag ) ; } return ( new \ React \ Promise \ Promise ( function ( callable $ resolve , callable $ reject ) use ( $ context , & $ values , $ bag , $ i ) { $ value = $ values [ $ i ] ; $ val = null ; $ validate = ( $ this -> validate ? array ( $ this , 'validate' ) : array ( $ this -> type , 'validate' ) ) ( $ value , $ context , $ this ) ; if ( ! ( $ validate instanceof \ React \ Promise \ PromiseInterface ) ) { $ validate = \ React \ Promise \ resolve ( $ validate ) ; } return $ validate -> then ( function ( $ valid ) use ( $ context , $ value , $ bag , & $ val ) { if ( $ valid !== true ) { $ val = $ valid ; return $ this -> obtainInfinite ( $ context , array ( $ value ) , $ bag , $ val ) ; } return ( $ this -> parse ? array ( $ this , 'parse' ) : array ( $ this -> type , 'parse' ) ) ( $ value , $ context , $ this ) ; } ) -> then ( function ( $ value ) use ( $ context , & $ values , $ bag , $ i , & $ val ) { if ( $ val !== null ) { return $ value ; } $ bag -> values [ ] = $ value ; $ i ++ ; if ( $ i < \ count ( $ values ) ) { return $ this -> parseInfiniteProvided ( $ context , $ values , $ bag , $ i ) ; } return $ bag -> done ( ) ; } ) -> done ( $ resolve , $ reject ) ; } ) ) ; }
Parses the provided infinite arguments.
@param \CharlotteDunois\Livia\Commands\Context       $context      Message that triggered the command.
@param string[]                                      $values       Pre-provided values.
@param \CharlotteDunois\Livia\Arguments\ArgumentBag  $bag          The argument bag.
@param int                                           $i            Current index of current argument value.
@return \React\Promise\ExtendedPromiseInterface
Parses the provided infinite arguments .