function setProvider(\CharlotteDunois\Livia\Providers\SettingProvider $provider) {
        $this->provider = $provider;
        
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) {
            $classname = \get_class($this->provider);
            
            if($this->readyTimestamp !== null) {
                $this->emit('debug', 'Provider set to '.$classname.' - initializing...');
                $this->provider->init($this)->done($resolve, $reject);
                return;
            }
            
            $this->emit('debug', 'Provider set to '.$classname.' - will initialize once ready');
            
            $this->once('ready', function () use ($resolve, $reject) {
                $this->emit('debug', 'Initializing provider...');
                $this->provider->init($this)->done(function () use ($resolve) {
                    $this->emit('debug', 'Provider finished initialization.');
                    $resolve();
                }, $reject);
            });
        }));
    }
function setProvider(\CharlotteDunois\Livia\Providers\SettingProvider $provider) {
        $this->provider = $provider;
        
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) {
            $classname = \get_class($this->provider);
            
            if($this->readyTimestamp !== null) {
                $this->emit('debug', 'Provider set to '.$classname.' - initializing...');
                $this->provider->init($this)->done($resolve, $reject);
                return;
            }
            
            $this->emit('debug', 'Provider set to '.$classname.' - will initialize once ready');
            
            $this->once('ready', function () use ($resolve, $reject) {
                $this->emit('debug', 'Initializing provider...');
                $this->provider->init($this)->done(function () use ($resolve) {
                    $this->emit('debug', 'Provider finished initialization.');
                    $resolve();
                }, $reject);
            });
        }));
    }
function setProvider ( \ CharlotteDunois \ Livia \ Providers \ SettingProvider $ provider ) { $ this -> provider = $ provider ; return ( new \ React \ Promise \ Promise ( function ( callable $ resolve , callable $ reject ) { $ classname = \ get_class ( $ this -> provider ) ; if ( $ this -> readyTimestamp !== null ) { $ this -> emit ( 'debug' , 'Provider set to ' . $ classname . ' - initializing...' ) ; $ this -> provider -> init ( $ this ) -> done ( $ resolve , $ reject ) ; return ; } $ this -> emit ( 'debug' , 'Provider set to ' . $ classname . ' - will initialize once ready' ) ; $ this -> once ( 'ready' , function ( ) use ( $ resolve , $ reject ) { $ this -> emit ( 'debug' , 'Initializing provider...' ) ; $ this -> provider -> init ( $ this ) -> done ( function ( ) use ( $ resolve ) { $ this -> emit ( 'debug' , 'Provider finished initialization.' ) ; $ resolve ( ) ; } , $ reject ) ; } ) ; } ) ) ; }
Sets the setting provider to use, and initializes it once the client is ready.
@param \CharlotteDunois\Livia\Providers\SettingProvider  $provider
@return \React\Promise\ExtendedPromiseInterface
Sets the setting provider to use and initializes it once the client is ready .