You are here

function _coder_review_severity in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_review/coder_review.common.inc \_coder_review_severity()

Return the integer severity magic number for a string severity.

Parameters

$severity_name: String severity name 'minor', 'normal', or 'critical'.

$default_value: Integer magic number to use if severity string is not recognized.

Return value

Integer magic number, see SEVERITY_* constants.

2 calls to _coder_review_severity()
coder_review_drush_review in coder_review/coder_review.drush.inc
Do the actual review.
do_coder_review in coder_review/coder_review.module
Perform code review for a review array.

File

coder_review/coder_review.module, line 1598

Code

function _coder_review_severity($severity_name, $default_value = SEVERITY_NORMAL) {

  // NOTE: Implemented this way in hopes that it is faster than a php switch.
  if (!isset($severity_names)) {
    $severity_names = array(
      'minor' => SEVERITY_MINOR,
      'normal' => SEVERITY_NORMAL,
      'critical' => SEVERITY_CRITICAL,
    );
  }
  if (isset($severity_names[$severity_name])) {
    return $severity_names[$severity_name];
  }
  return $default_value;
}