original_string: public function setSlaveOkay($ok = true)
      {
          if (version_compare(phpversion('mongo'), '1.3.0', '<')) {
              return $this->riak->setSlaveOkay($ok);
          }
  
          $prevSlaveOkay = $this->getSlaveOkay();
  
          if ($ok) {
              // Preserve existing tags for non-primary read preferences
              $readPref = $this->getReadPreference();
              $tags = ! empty($readPref['tagsets']) ? $readPref['tagsets'] : array();
              $this->riak->setReadPreference(\RiakClient::RP_SECONDARY_PREFERRED, $tags);
          } else {
              $this->riak->setReadPreference(\RiakClient::RP_PRIMARY);
          }
  
          return $prevSlaveOkay;
      }
code: public function setSlaveOkay($ok = true)
      {
          if (version_compare(phpversion('mongo'), '1.3.0', '<')) {
              return $this->riak->setSlaveOkay($ok);
          }
  
          $prevSlaveOkay = $this->getSlaveOkay();
  
          if ($ok) {
              // Preserve existing tags for non-primary read preferences
              $readPref = $this->getReadPreference();
              $tags = ! empty($readPref['tagsets']) ? $readPref['tagsets'] : array();
              $this->riak->setReadPreference(\RiakClient::RP_SECONDARY_PREFERRED, $tags);
          } else {
              $this->riak->setReadPreference(\RiakClient::RP_PRIMARY);
          }
  
          return $prevSlaveOkay;
      }
code_tokens: public function setSlaveOkay ( $ ok = true ) { if ( version_compare ( phpversion ( 'mongo' ) , '1.3.0' , '<' ) ) { return $ this -> riak -> setSlaveOkay ( $ ok ) ; } $ prevSlaveOkay = $ this -> getSlaveOkay ( ) ; if ( $ ok ) { // Preserve existing tags for non-primary read preferences $ readPref = $ this -> getReadPreference ( ) ; $ tags = ! empty ( $ readPref [ 'tagsets' ] ) ? $ readPref [ 'tagsets' ] : array ( ) ; $ this -> riak -> setReadPreference ( \ RiakClient :: RP_SECONDARY_PREFERRED , $ tags ) ; } else { $ this -> riak -> setReadPreference ( \ RiakClient :: RP_PRIMARY ) ; } return $ prevSlaveOkay ; }
docstring: Set whether secondary read queries are allowed for this database.
  
  This method wraps setSlaveOkay() for driver versions before 1.3.0. For
  newer drivers, this method wraps setReadPreference() and specifies
  SECONDARY_PREFERRED.
  
  @see http://php.net/manual/en/mongodb.setreadpreference.php
  @see http://php.net/manual/en/mongodb.setslaveokay.php
  @param boolean $ok
  @return boolean Previous slaveOk value
docstring_tokens: Set whether secondary read queries are allowed for this database .