public static function convertToInt($val, array $valueSet)
    {
        if ($val === null) {

            return 0;
        }
        if (!is_array($val)) {
            $val = [$val];
        }
        $bitValueArr = array_pad([], count($valueSet), '0');
        foreach ($val as $value) {
            if (!in_array($value, $valueSet)) {
                throw new SetColumnConverterException(sprintf('Value "%s" is not among the valueSet', $value), $value);
            }
            $bitValueArr[array_search($value, $valueSet)] = '1';
        }
        
        return base_convert(implode(array_reverse($bitValueArr)), 2, 10);
    }
public static function convertToInt($val, array $valueSet)
    {
        if ($val === null) {

            return 0;
        }
        if (!is_array($val)) {
            $val = [$val];
        }
        $bitValueArr = array_pad([], count($valueSet), '0');
        foreach ($val as $value) {
            if (!in_array($value, $valueSet)) {
                throw new SetColumnConverterException(sprintf('Value "%s" is not among the valueSet', $value), $value);
            }
            $bitValueArr[array_search($value, $valueSet)] = '1';
        }
        
        return base_convert(implode(array_reverse($bitValueArr)), 2, 10);
    }
public static function convertToInt ( $ val , array $ valueSet ) { if ( $ val === null ) { return 0 ; } if ( ! is_array ( $ val ) ) { $ val = [ $ val ] ; } $ bitValueArr = array_pad ( [ ] , count ( $ valueSet ) , '0' ) ; foreach ( $ val as $ value ) { if ( ! in_array ( $ value , $ valueSet ) ) { throw new SetColumnConverterException ( sprintf ( 'Value "%s" is not among the valueSet' , $ value ) , $ value ) ; } $ bitValueArr [ array_search ( $ value , $ valueSet ) ] = '1' ; } return base_convert ( implode ( array_reverse ( $ bitValueArr ) ) , 2 , 10 ) ; }
Converts set column values to the corresponding integer.

@param mixed $val
@param array $valueSet
@return int|null

@throws SetColumnConverterException
Converts set column values to the corresponding integer .