original_string: public function factory()
      {
          $redis = new \Redis();
          $host = $this->getConfig()->getValue(self::CONFIG_HOST);
          $port = $this->getConfig()->getValue(self::CONFIG_PORT);
          $timeout = $this->getConfig()->getValue(self::CONFIG_TIMEOUT);
  
          if ($this->getConfig()->getValueFlag(self::CONFIG_PERSISTENT)) {
              $redis->pconnect($host, $port, $timeout);
          } else {
              $redis->connect($host, $port, $timeout);
          }
  
          if ($this->getConfig()->hasValue(self::CONFIG_DATABASE)) {
              $redis->select($this->getConfig()->getValue(self::CONFIG_DATABASE));
          }
  
          return $redis;
      }
code: public function factory()
      {
          $redis = new \Redis();
          $host = $this->getConfig()->getValue(self::CONFIG_HOST);
          $port = $this->getConfig()->getValue(self::CONFIG_PORT);
          $timeout = $this->getConfig()->getValue(self::CONFIG_TIMEOUT);
  
          if ($this->getConfig()->getValueFlag(self::CONFIG_PERSISTENT)) {
              $redis->pconnect($host, $port, $timeout);
          } else {
              $redis->connect($host, $port, $timeout);
          }
  
          if ($this->getConfig()->hasValue(self::CONFIG_DATABASE)) {
              $redis->select($this->getConfig()->getValue(self::CONFIG_DATABASE));
          }
  
          return $redis;
      }
code_tokens: public function factory ( ) { $ redis = new \ Redis ( ) ; $ host = $ this -> getConfig ( ) -> getValue ( self :: CONFIG_HOST ) ; $ port = $ this -> getConfig ( ) -> getValue ( self :: CONFIG_PORT ) ; $ timeout = $ this -> getConfig ( ) -> getValue ( self :: CONFIG_TIMEOUT ) ; if ( $ this -> getConfig ( ) -> getValueFlag ( self :: CONFIG_PERSISTENT ) ) { $ redis -> pconnect ( $ host , $ port , $ timeout ) ; } else { $ redis -> connect ( $ host , $ port , $ timeout ) ; } if ( $ this -> getConfig ( ) -> hasValue ( self :: CONFIG_DATABASE ) ) { $ redis -> select ( $ this -> getConfig ( ) -> getValue ( self :: CONFIG_DATABASE ) ) ; } return $ redis ; }
docstring: Creates a configured \Redis instance in the object context
  
  @param ConfigInterface $config
  @return \Redis
docstring_tokens: Creates a configured \ Redis instance in the object context