/** * calculate the absolute probability based on the (possibly) relative value in the config */ private function get_probability($string_value, CRM_Banking_BAO_BankTransaction $btx) { if (substr($string_value, -1) === "%") { // if the value ends in '%' it's meant to be relative to the least probable suggestion $suggestion_list = $btx->getSuggestionList(); $least_probable = end($suggestion_list); if ($least_probable) { $least_probable_value = $least_probable->getProbability(); } else { $least_probable_value = 1; } return $least_probable_value * substr($string_value, 0, strlen($string_value) - 1) / 100.0; } else { // in the default case, we just assume it's an absolute value anyways... return $string_value; } }