original_string: public function setRedis(?RedisClient $redis = null)
      {
          if (! $redis) {
              $server = Arr::get($this->config, 'server', []);
              $options = Arr::get($this->config, 'options', []);
  
              // forbid setting prefix from options
              if (Arr::has($options, 'prefix')) {
                  $options = Arr::except($options, 'prefix');
              }
  
              $redis = new RedisClient($server, $options);
          }
  
          $this->redis = $redis;
      }
code: public function setRedis(?RedisClient $redis = null)
      {
          if (! $redis) {
              $server = Arr::get($this->config, 'server', []);
              $options = Arr::get($this->config, 'options', []);
  
              // forbid setting prefix from options
              if (Arr::has($options, 'prefix')) {
                  $options = Arr::except($options, 'prefix');
              }
  
              $redis = new RedisClient($server, $options);
          }
  
          $this->redis = $redis;
      }
code_tokens: public function setRedis ( ? RedisClient $ redis = null ) { if ( ! $ redis ) { $ server = Arr :: get ( $ this -> config , 'server' , [ ] ) ; $ options = Arr :: get ( $ this -> config , 'options' , [ ] ) ; // forbid setting prefix from options if ( Arr :: has ( $ options , 'prefix' ) ) { $ options = Arr :: except ( $ options , 'prefix' ) ; } $ redis = new RedisClient ( $ server , $ options ) ; } $ this -> redis = $ redis ; }
docstring: Set redis client.
  
  @param \Predis\Client|null $redis
docstring_tokens: Set redis client .