src/bbn/user/preferences.php
public function get_max_bit_num(string $id_user_option, string $id_parent = null, bool $incr = false): int
  {
    if ( 
      \bbn\str::is_uid($id_user_option) &&
      (\bbn\str::is_uid($id_parent) || is_null($id_parent)) &&
      ($cf = $this->get_class_cfg()) &&
      ($cfg =  $cf['arch']['user_options_bits'])
    ){
      if ( $max = $this->db->select_one([
        'table' => $cf['tables']['user_options_bits'], 
        'fields' => ["MAX($cfg[num])"],
        'where' => [
          'conditions' => [[
            'field' => $cfg['id_user_option'],
            'value' => $id_user_option
          ], [
            'field' => $cfg['id_parent'],
            empty($id_parent) ? 'operator' : 'value' => $id_parent ?: 'isnull'
          ]]
        ]
      ]) ){
        $max = (int)$max;
        return $incr ? $max+1 : $max;
      }
      return 0;
    }
  }
public function get_max_bit_num(string $id_user_option, string $id_parent = null, bool $incr = false): int
  {
    if ( 
      \bbn\str::is_uid($id_user_option) &&
      (\bbn\str::is_uid($id_parent) || is_null($id_parent)) &&
      ($cf = $this->get_class_cfg()) &&
      ($cfg =  $cf['arch']['user_options_bits'])
    ){
      if ( $max = $this->db->select_one([
        'table' => $cf['tables']['user_options_bits'], 
        'fields' => ["MAX($cfg[num])"],
        'where' => [
          'conditions' => [[
            'field' => $cfg['id_user_option'],
            'value' => $id_user_option
          ], [
            'field' => $cfg['id_parent'],
            empty($id_parent) ? 'operator' : 'value' => $id_parent ?: 'isnull'
          ]]
        ]
      ]) ){
        $max = (int)$max;
        return $incr ? $max+1 : $max;
      }
      return 0;
    }
  }
public function get_max_bit_num ( string $ id_user_option , string $ id_parent = null , bool $ incr = false ) : int { if ( \ bbn \ str :: is_uid ( $ id_user_option ) && ( \ bbn \ str :: is_uid ( $ id_parent ) || is_null ( $ id_parent ) ) && ( $ cf = $ this -> get_class_cfg ( ) ) && ( $ cfg = $ cf [ 'arch' ] [ 'user_options_bits' ] ) ) { if ( $ max = $ this -> db -> select_one ( [ 'table' => $ cf [ 'tables' ] [ 'user_options_bits' ] , 'fields' => [ "MAX($cfg[num])" ] , 'where' => [ 'conditions' => [ [ 'field' => $ cfg [ 'id_user_option' ] , 'value' => $ id_user_option ] , [ 'field' => $ cfg [ 'id_parent' ] , empty ( $ id_parent ) ? 'operator' : 'value' => $ id_parent ? : 'isnull' ] ] ] ] ) ) { $ max = ( int ) $ max ; return $ incr ? $ max + 1 : $ max ; } return 0 ; } }
Gets the maximum num value of the user option's bits.

@param string $id_user_option The user option's ID
@param string|null $id_parent The parent's ID
@param bool $incr Set it to true if you want the result increased by 1
@return int
Gets the maximum num value of the user option s bits .