original_string: public function set_preferences($id_user, $id_file, $md5, array $cfg = null, bbn\user\preferences $pref = null){
      if ( !empty($id_user) && !empty($id_file) && !empty($pref) ){
        $change['md5'] = $md5;
        if ( !empty($cfg['selections']) ){
          $change['selections'] = $cfg['selections'];
        }
        if ( isset($cfg, $cfg['marks']) ){
          $change['marks'] = $cfg['marks'];
        }
        if ( !empty($change) ){
          $id_option = $this->option_id($id_file);
          if ( $pref->set($id_option, $change, $id_user) ){
            return true;
          }
        }
      }
      return false;
    }
code: public function set_preferences($id_user, $id_file, $md5, array $cfg = null, bbn\user\preferences $pref = null){
      if ( !empty($id_user) && !empty($id_file) && !empty($pref) ){
        $change['md5'] = $md5;
        if ( !empty($cfg['selections']) ){
          $change['selections'] = $cfg['selections'];
        }
        if ( isset($cfg, $cfg['marks']) ){
          $change['marks'] = $cfg['marks'];
        }
        if ( !empty($change) ){
          $id_option = $this->option_id($id_file);
          if ( $pref->set($id_option, $change, $id_user) ){
            return true;
          }
        }
      }
      return false;
    }
code_tokens: public function set_preferences ( $ id_user , $ id_file , $ md5 , array $ cfg = null , bbn \ user \ preferences $ pref = null ) { if ( ! empty ( $ id_user ) && ! empty ( $ id_file ) && ! empty ( $ pref ) ) { $ change [ 'md5' ] = $ md5 ; if ( ! empty ( $ cfg [ 'selections' ] ) ) { $ change [ 'selections' ] = $ cfg [ 'selections' ] ; } if ( isset ( $ cfg , $ cfg [ 'marks' ] ) ) { $ change [ 'marks' ] = $ cfg [ 'marks' ] ; } if ( ! empty ( $ change ) ) { $ id_option = $ this -> option_id ( $ id_file ) ; if ( $ pref -> set ( $ id_option , $ change , $ id_user ) ) { return true ; } } } return false ; }
docstring: Sets user's preferences for a file.
  
  @param string $id_user The user's id
  @param string $id_file The file's id
  @param string $md5 The file's md5
  @param array|null $cfg
  @param bbn\user\preferences|null $pref
  @return bool
docstring_tokens: Sets user s preferences for a file .