You are here

function _coder_severity in Coder 6

Same name and namespace in other branches
  1. 5.2 coder.module \_coder_severity()
  2. 5 coder.module \_coder_severity()
  3. 6.2 coder.module \_coder_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_severity()
coder_drush_review in ./coder.drush.inc
do_coder_review in ./coder.module
Perform code review for a review array.

File

./coder.module, line 1315
Developer Module that assists with code review and version upgrade that supports a plug-in extensible hook system so contributed modules can define additional review standards.

Code

function _coder_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;
}